You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
import{typeOf,valuesOf,ReflectionClass,validate,is}from"@deepkit/type";typeFoo<T>=Textends[...infer Pextendsstring[], infer L] ? L : nevertypeBar=Foo<[string,string,number]>// Bar is numberconsole.log('valRes',is<Bar>('hello'))// true (expect to be false)console.log('valRes',is<Bar>(1))// false (expect to be true)console.log('valRes',is<number>(1))// trueconsole.log('type',typeOf<Bar>())// kind: 5 (expect to be 6)
We need a new bytecode OP inferConstrained or something like that to have it backward compatible, and then consume TypeParameterDeclaration.constraint in the AST node (narrowed.typeParameter.constraint)
codesandbox
it seems the inference of Bar result in 'string' rather than 'number'
The text was updated successfully, but these errors were encountered: