Test indexed access to this on intersections (#40967)

* Added test.

* Accepted baselines.
This commit is contained in:
Daniel Rosenwasser
2020-10-06 14:18:44 -07:00
committed by GitHub
parent 692502e99f
commit 3766be1bde
4 changed files with 44 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
//// [indexedAccessToThisTypeOnIntersection01.ts]
interface A {
a: string;
getA: this['a'];
}
type T = (A & { a: number })['getA'];
//// [indexedAccessToThisTypeOnIntersection01.js]

View File

@@ -0,0 +1,16 @@
=== tests/cases/compiler/indexedAccessToThisTypeOnIntersection01.ts ===
interface A {
>A : Symbol(A, Decl(indexedAccessToThisTypeOnIntersection01.ts, 0, 0))
a: string;
>a : Symbol(A.a, Decl(indexedAccessToThisTypeOnIntersection01.ts, 0, 13))
getA: this['a'];
>getA : Symbol(A.getA, Decl(indexedAccessToThisTypeOnIntersection01.ts, 1, 12))
}
type T = (A & { a: number })['getA'];
>T : Symbol(T, Decl(indexedAccessToThisTypeOnIntersection01.ts, 3, 1))
>A : Symbol(A, Decl(indexedAccessToThisTypeOnIntersection01.ts, 0, 0))
>a : Symbol(a, Decl(indexedAccessToThisTypeOnIntersection01.ts, 5, 15))

View File

@@ -0,0 +1,13 @@
=== tests/cases/compiler/indexedAccessToThisTypeOnIntersection01.ts ===
interface A {
a: string;
>a : string
getA: this['a'];
>getA : this["a"]
}
type T = (A & { a: number })['getA'];
>T : never
>a : number

View File

@@ -0,0 +1,6 @@
interface A {
a: string;
getA: this['a'];
}
type T = (A & { a: number })['getA'];