Skip to content

Latest commit

 

History

History
28 lines (17 loc) · 1.24 KB

types.basetypeimpl.withconfig.md

File metadata and controls

28 lines (17 loc) · 1.24 KB

Home > @skunkteam/types > BaseTypeImpl > withConfig

BaseTypeImpl.withConfig() method

Create a new instance of this Type with the additional type-specific config, such as min/max values.

Signature:

withConfig<const BrandName extends string>(name: BrandName, newConfig: TypeConfig): Type<Branded<ResultType, BrandName>, TypeConfig>;

Parameters

Parameter Type Description
name BrandName the name to use in error messages
newConfig TypeConfig the new type-specific config that further restricts the accepted values

Returns:

Type<Branded<ResultType, BrandName>, TypeConfig>

Remarks

Creates a brand. By creating a branded type, we ensure that TypeScript will consider this a separate type, see Branded for more information.