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
typeAll='a'|'b'|'c';typeA='a';constconfig={a: ()=>console.log('a'),}satisfiesRecord<A,()=>void>;constall: All=Math.random()>0.5 ? 'a' : 'b';if(allinconfig){// Property 'b' does not exist on type '{ a: () => void; }'.(7053)config[all]();// expected: all is typeof 'a'}
π Actual behavior
Got an error: Property 'b' does not exist on type '{ a: () => void; }'.(7053)
π Expected behavior
I expected to all be a type of 'a' after in operator. Like guard will do:
functionguard(a: All): a is A{returnainconfig;}
Additional information about the issue
No response
The text was updated successfully, but these errors were encountered:
π Search Terms
extract union in operator
π Version & Regression Information
β― Playground Link
https://www.typescriptlang.org/play/?ssl=12&ssc=7&pln=12&pc=71#code/C4TwDgpgBAggNnKBeKByAhqqAfNAjLXVAY1QG4AoC0SWZNTSi4gewDsBnYKVtgMwCWAc3oBvClElR0ALigAKAJTIAfD3YcWcCADo4LIfIypFAGgoBfKB3TABHQRA5QAShFYAnACYAeGKYVlJDUANxYBLxUmXi5pBDl4RBQAWVsACx0PdDYvFgBbJSg1AAYdAFYoAH4GLDlUAiYBPgV0BCgBNnV+YWVxKSgAegGoAAUPFkgPUHwsXKcoNhZuCAAPe252KBpoVFFpOULgqDCIsigLVB15AHZisoBmRQkpXkEhAG1WuABdJUp+oZQVaQYjACBeORfdrObYsZrGSxAA
π» Code
π Actual behavior
Got an error: Property 'b' does not exist on type '{ a: () => void; }'.(7053)
π Expected behavior
I expected to
all
be a type of 'a' after in operator. Like guard will do:Additional information about the issue
No response
The text was updated successfully, but these errors were encountered: