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
While testing custom type, I met some bug like this:
it("ObjectType type test",()=>{typeObjectType<T,Kextendsstring|number|symbol=string>=Record<K,T>;// given & whenconstresult={a: "1",b: "2",c: "3",d: "4",e: "5"};// thenexpectType<ObjectType<string>>(result);// test passedexpectType<ObjectType<string,symbol>>(result);// test passedexpectType<ObjectType<string,number>>(result);// test passedexpectNotType<ObjectType<string,number>>(result);// test passed}
I think, may be there's something problem in checking types with default param.
So I check another test case.
normal case
typeTestType<Textendsstring|number>=Record<T,string>;consttest={a: 1};expectType<TestType<string>>(test);// ide warn, test failedexpectNotType<TestType<string>>(test);
problem case
typeTestType<Textendsstring|number=string>=Record<T,string>;consttest={a: 1};expectType<TestType<string>>(test);// ide warn, but test passedexpectNotType<TestType<string>>(test);// test passed
typeTestType<K,Textendsstring|number=string>=Record<T,K>;consttest={a: 1};expectType<TestType<string,number>>(test);// no warning, test passedexpectNotType<TestType<string,number>>(test);// test passed, problem occurred!
Can anyone please explain this result?
The text was updated successfully, but these errors were encountered:
While testing custom type, I met some bug like this:
I think, may be there's something problem in checking types with default param.
So I check another test case.
normal case
problem case
Can anyone please explain this result?
The text was updated successfully, but these errors were encountered: