|
15 | 15 | //// declare function f9<T extends {}>(obj: T): void; |
16 | 16 | //// declare function f10<T extends Empty>(obj: T): void; |
17 | 17 | //// declare function f11<T extends (Empty | Record<string, any> | {})>(obj: T): void; |
18 | | -//// declare function f12(obj: Object): void; |
19 | | -//// declare function f13<T extends Object>(obj: T): void; |
20 | | -//// declare function f14(obj: Typed): void; |
21 | | -//// declare function f15<T extends (Empty | Object | Typed)>(obj: T): void; |
22 | | -//// declare function f16(obj: Record<number, any>): void; |
23 | | -//// declare function f17(obj: { [key: string]: number, prop: number }): void; |
24 | | -//// declare function f18(obj: { [key: number]: number }): void; |
| 18 | +//// declare function f12(obj: Typed): void; |
| 19 | +//// declare function f13<T extends (Empty | Typed)>(obj: T): void; |
| 20 | +//// declare function f14(obj: { [key: string]: number, prop: number }): void; |
| 21 | +//// declare function f15(obj: Record<number, any>): void; |
| 22 | +//// declare function f16(obj: { [key: number]: number }): void; |
25 | 23 |
|
26 | 24 | //// f1({f/*1*/}); |
27 | 25 | //// f2({f/*2*/}); |
|
39 | 37 | //// f14({f/*14*/}); |
40 | 38 | //// f15({f/*15*/}); |
41 | 39 | //// f16({f/*16*/}); |
42 | | -//// f17({f/*17*/}); |
43 | | -//// f18({f/*18*/}); |
44 | 40 |
|
| 41 | +const locals = [ |
| 42 | + ...(() => { |
| 43 | + const symbols = []; |
| 44 | + for (let i = 1; i <= 16; i ++) { |
| 45 | + symbols.push(`f${i}`); |
| 46 | + } |
| 47 | + return symbols; |
| 48 | + })(), |
| 49 | + "foo" |
| 50 | +]; |
45 | 51 | verify.completions( |
46 | | - { marker: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"], includes: ["foo"]}, |
47 | | - { marker: ["12", "13", "14", "15"], excludes: ["foo"]}, |
48 | | - { marker: ["16", "17", "18"], excludes: ["foo"], isNewIdentifierLocation: true}, |
| 52 | + // Non-contextual, any, unknown, object, Record<string, ..>, [key: string]: .., Type parameter, etc.. |
| 53 | + { marker: ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11"], exact: completion.globalsPlus(locals)}, |
| 54 | + // Has named property |
| 55 | + { marker: ["12", "13"], exact: "typed"}, |
| 56 | + // Has both StringIndexType and named property |
| 57 | + { marker: ["14"], exact: "prop", isNewIdentifierLocation: true}, |
| 58 | + // NumberIndexType |
| 59 | + { marker: ["15", "16"], exact: [], isNewIdentifierLocation: true}, |
49 | 60 | ); |
0 commit comments