Skip to content

Latest commit

 

History

History
29 lines (17 loc) · 1.8 KB

types.interfacetype.withrequired.md

File metadata and controls

29 lines (17 loc) · 1.8 KB

Home > @skunkteam/types > InterfaceType > withRequired

InterfaceType.withRequired() method

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>>>;

Parameters

Parameter Type Description
args [props: OtherProps] | [name: string, props: OtherProps] | [options: InterfaceMergeOptions, props: OtherProps]

Returns:

MergeType<Props, ResultType, OtherProps, TypeOfProperties<Writable<OtherProps>>>

Remarks

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.