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
let x: string | number | boolean; x = ""; // 1 while (/*...*/) { x; // 2 x = foo(x); // 3 x; // 4 } x; // 5 function foo(x: string): number; function foo(x: number): boolean; function foo(x: boolean): string; function foo() { // ... }
How do you determine all the types of x?
x
string
Issues with loops.
Need to introduce the notion of "incomplete types".
What if you never hit a fixed point?
Still issues with circularly dependent variables:
let x: string | number | boolean; x = ""; // 1 while (/*...*/) { x; // 2 let y = foo(x); // 3 x = y; // 4 x; // 5 } x; // 6 function foo(x: string): number; function foo(x: number): boolean; function foo(x: boolean): string; function foo() { // ... }
undefined
null
this
new
interface FooType { x: number; } function Foo(this: FooType, x: number) { this.x = x; } let foo = new Foo(12);
Foo
function new Foo(x: number): FooType;
The text was updated successfully, but these errors were encountered:
+
No branches or pull requests
Control flow based type analysis (#8010)
How do you determine all the types of
x
?x
can at least have typestring
.Issues with loops.
Need to introduce the notion of "incomplete types".
What if you never hit a fixed point?
x
, we don't add!Still issues with circularly dependent variables:
Some other issues
undefined
andnull
even if they're not in the union of types you have.Functions with
this
types called withnew
(#8109)Foo
benew
-able?Foo
might be a plugin or callback with an intendedthis
binding.function new Foo(x: number): FooType;
.Indexing with enums and string literals (#2491, #7656)
Numeric Literal Types (#7480)
The text was updated successfully, but these errors were encountered: