Home > @skunkteam/types > InterfaceType > withRequired
Create a type with all properties of the current type, plus the given additional required properties.
Signature:
withRequired<OtherProps extends Properties>(...args: [props: OtherProps] | [name: string, props: OtherProps] | [options: InterfaceMergeOptions, props: OtherProps]): MergeType<Props, ResultType, OtherProps, TypeOfProperties<Writable<OtherProps>>>;
Parameter | Type | Description |
---|---|---|
args | [props: OtherProps] | [name: string, props: OtherProps] | [options: InterfaceMergeOptions, props: OtherProps] |
Returns:
MergeType<Props, ResultType, OtherProps, TypeOfProperties<Writable<OtherProps>>>
Note that any property that conflicts with an existing property is overwritten, so this can also be used to selectively mark certain properties as required or change their type.
Any options such as strictMissingKeys
and custom names (unless provided in this call) will be inherited by this new type, but custom parsers and validators are dropped.