Home > @skunkteam/types > BaseTypeImpl > withConfig
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>;
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>
Creates a brand. By creating a branded type, we ensure that TypeScript will consider this a separate type, see Branded for more information.