Closed kungfooman closed 6 months ago
Fixes: #117
PR is adding this API to solve the problem:
const str = '{[Key in 1|2|3]: {testkey: [Key, Key, Key], bla: Key}}'; const mapping = expandType(str); const type = createTypeFromMapping(mapping); const keys = Object.values(type.properties).map(_ => _.properties.bla); const ret = keys[0] === 1 && keys[1] === 2 && keys[2] === 3; console.log(`The keys should be [1, 2, 3]: ${keys} (${ret})`, {keys, type});
Basically type is an intermediary type, which isn't a mapped type any longer... but expanded - which then can be used normally to compare a value with a type via validateType again.
type
validateType
Fixes: #117
PR is adding this API to solve the problem:
Basically
type
is an intermediary type, which isn't a mapped type any longer... but expanded - which then can be used normally to compare a value with a type viavalidateType
again.