Closed
Description
TypeScript Version: 2.2
Code
type Options = {
text: string;
};
// Demonstrates fail with undefined
interface Foo {
foo(kind: 'Bar', state?: undefined): void;
foo(kind: 'Foo', state?: Options): void;
}
let f: Foo;
f.foo('Foo', { t }) // No completion offered for 't'
// Demonstrates fail with void
interface Foo2 {
foo(kind: 'Bar', state?: void): void;
foo(kind: 'Foo', state?: Options): void;
}
let ff: Foo2;
ff.foo('Foo', { t }) // No completion here either
// Demonstrates success after changing order of overloads
interface Foo3 {
foo(kind: 'Foo', state?: Options): void;
foo(kind: 'Bar', state?: undefined): void;
}
let fff: Foo3;
fff.foo('Foo', { t }) // Okay: completion offered for 't'
Expected behavior:
Completion for the property "text" where it says "No completion offered for 't'"
Actual behavior:
There is no completion for "text" when "t" is typed.