mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 04:43:37 -05:00
Test indexed access to this on intersections (#40967)
* Added test. * Accepted baselines.
This commit is contained in:
committed by
GitHub
parent
692502e99f
commit
3766be1bde
@@ -0,0 +1,9 @@
|
||||
//// [indexedAccessToThisTypeOnIntersection01.ts]
|
||||
interface A {
|
||||
a: string;
|
||||
getA: this['a'];
|
||||
}
|
||||
|
||||
type T = (A & { a: number })['getA'];
|
||||
|
||||
//// [indexedAccessToThisTypeOnIntersection01.js]
|
||||
@@ -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))
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
interface A {
|
||||
a: string;
|
||||
getA: this['a'];
|
||||
}
|
||||
|
||||
type T = (A & { a: number })['getA'];
|
||||
Reference in New Issue
Block a user