Skip to content

Commit 95f5bc1

Browse files
committed
Add unknown property to test of contextual this type
1 parent 08ae022 commit 95f5bc1

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

tests/baselines/reference/contextualThisTypeInJavascript.symbols

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@ const obj = {
2020
>this.method : Symbol(method, Decl(context.js, 1, 12))
2121
>this : Symbol(obj, Decl(context.js, 0, 11))
2222
>method : Symbol(method, Decl(context.js, 1, 12))
23+
24+
this.unknown; // ok, obj has a string indexer
25+
>this : Symbol(obj, Decl(context.js, 0, 11))
2326
}
2427
}
2528

tests/baselines/reference/contextualThisTypeInJavascript.types

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
=== tests/cases/conformance/types/thisType/context.js ===
22
const obj = {
33
>obj : { [x: string]: any; prop: number; method(): void; }
4-
>{ prop: 2, method() { this; this.prop; this.method; }} : { [x: string]: any; prop: number; method(): void; }
4+
>{ prop: 2, method() { this; this.prop; this.method; this.unknown; // ok, obj has a string indexer }} : { [x: string]: any; prop: number; method(): void; }
55

66
prop: 2,
77
>prop : number
@@ -22,6 +22,11 @@ const obj = {
2222
>this.method : () => void
2323
>this : { [x: string]: any; prop: number; method(): void; }
2424
>method : () => void
25+
26+
this.unknown; // ok, obj has a string indexer
27+
>this.unknown : any
28+
>this : { [x: string]: any; prop: number; method(): void; }
29+
>unknown : any
2530
}
2631
}
2732

tests/cases/conformance/types/thisType/contextualThisTypeInJavascript.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@ const obj = {
88
this;
99
this.prop;
1010
this.method;
11+
this.unknown; // ok, obj has a string indexer
1112
}
1213
}

0 commit comments

Comments
 (0)