We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
This is a regression.
Inference was OK on 4.7.4 but broken on 4.8.4 and 4.9.5 (tested on the playground).
4.7.4
4.8.4
4.9.5
Playground link with relevant code
export type Writable<T> = { -readonly [K in keyof T]: T[K]; }; class Foo { readonly foo = 'foo'; } class Bar { readonly bar = 'bar'; } type WritableFooBar = Writable<Foo | Bar>; declare function isFoo(obj: any): obj is Foo; function test(foobar: WritableFooBar): void { if (!isFoo(foobar)) {} // happens also with if(isFoo()) foobar // ^? Foo | Writable<Bar> }
foobar is inference as Foo | Writable<Bar>
foobar
Foo | Writable<Bar>
foobar should be inferred as Writable<Foo|Bar> or WritableFooBar
Writable<Foo|Bar>
WritableFooBar
The text was updated successfully, but these errors were encountered:
Actually, this has been fixed with 5.0 but could find the PR that fixed it !
Sorry, something went wrong.
#52282
No branches or pull requests
Bug Report
π Search Terms
π Version & Regression Information
This is a regression.
Inference was OK on
4.7.4
but broken on4.8.4
and4.9.5
(tested on the playground).β― Playground Link
Playground link with relevant code
π» Code
π Actual behavior
foobar
is inference asFoo | Writable<Bar>
π Expected behavior
foobar
should be inferred asWritable<Foo|Bar>
orWritableFooBar
The text was updated successfully, but these errors were encountered: