mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-19 20:37:00 -05:00
Add test cases for union and intersection constraints
This commit is contained in:
@@ -3,7 +3,14 @@ class A {
|
||||
private a: number;
|
||||
}
|
||||
|
||||
type B<T extends A> = T["a"];
|
||||
class B {
|
||||
private a: string;
|
||||
}
|
||||
|
||||
type X<T extends A> = T["a"];
|
||||
type Y<T extends A | B> = T["a"];
|
||||
type Z<T extends A & B> = T["a"];
|
||||
|
||||
|
||||
|
||||
//// [indexedAccessPrivateMemberOfGenericConstraint.js]
|
||||
@@ -12,3 +19,8 @@ var A = /** @class */ (function () {
|
||||
}
|
||||
return A;
|
||||
}());
|
||||
var B = /** @class */ (function () {
|
||||
function B() {
|
||||
}
|
||||
return B;
|
||||
}());
|
||||
|
||||
@@ -6,9 +6,31 @@ class A {
|
||||
>a : Symbol(A.a, Decl(indexedAccessPrivateMemberOfGenericConstraint.ts, 0, 9))
|
||||
}
|
||||
|
||||
type B<T extends A> = T["a"];
|
||||
class B {
|
||||
>B : Symbol(B, Decl(indexedAccessPrivateMemberOfGenericConstraint.ts, 2, 1))
|
||||
>T : Symbol(T, Decl(indexedAccessPrivateMemberOfGenericConstraint.ts, 4, 7))
|
||||
>A : Symbol(A, Decl(indexedAccessPrivateMemberOfGenericConstraint.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(indexedAccessPrivateMemberOfGenericConstraint.ts, 4, 7))
|
||||
|
||||
private a: string;
|
||||
>a : Symbol(B.a, Decl(indexedAccessPrivateMemberOfGenericConstraint.ts, 4, 9))
|
||||
}
|
||||
|
||||
type X<T extends A> = T["a"];
|
||||
>X : Symbol(X, Decl(indexedAccessPrivateMemberOfGenericConstraint.ts, 6, 1))
|
||||
>T : Symbol(T, Decl(indexedAccessPrivateMemberOfGenericConstraint.ts, 8, 7))
|
||||
>A : Symbol(A, Decl(indexedAccessPrivateMemberOfGenericConstraint.ts, 0, 0))
|
||||
>T : Symbol(T, Decl(indexedAccessPrivateMemberOfGenericConstraint.ts, 8, 7))
|
||||
|
||||
type Y<T extends A | B> = T["a"];
|
||||
>Y : Symbol(Y, Decl(indexedAccessPrivateMemberOfGenericConstraint.ts, 8, 29))
|
||||
>T : Symbol(T, Decl(indexedAccessPrivateMemberOfGenericConstraint.ts, 9, 7))
|
||||
>A : Symbol(A, Decl(indexedAccessPrivateMemberOfGenericConstraint.ts, 0, 0))
|
||||
>B : Symbol(B, Decl(indexedAccessPrivateMemberOfGenericConstraint.ts, 2, 1))
|
||||
>T : Symbol(T, Decl(indexedAccessPrivateMemberOfGenericConstraint.ts, 9, 7))
|
||||
|
||||
type Z<T extends A & B> = T["a"];
|
||||
>Z : Symbol(Z, Decl(indexedAccessPrivateMemberOfGenericConstraint.ts, 9, 33))
|
||||
>T : Symbol(T, Decl(indexedAccessPrivateMemberOfGenericConstraint.ts, 10, 7))
|
||||
>A : Symbol(A, Decl(indexedAccessPrivateMemberOfGenericConstraint.ts, 0, 0))
|
||||
>B : Symbol(B, Decl(indexedAccessPrivateMemberOfGenericConstraint.ts, 2, 1))
|
||||
>T : Symbol(T, Decl(indexedAccessPrivateMemberOfGenericConstraint.ts, 10, 7))
|
||||
|
||||
|
||||
|
||||
@@ -6,6 +6,20 @@ class A {
|
||||
>a : number
|
||||
}
|
||||
|
||||
type B<T extends A> = T["a"];
|
||||
>B : T["a"]
|
||||
class B {
|
||||
>B : B
|
||||
|
||||
private a: string;
|
||||
>a : string
|
||||
}
|
||||
|
||||
type X<T extends A> = T["a"];
|
||||
>X : T["a"]
|
||||
|
||||
type Y<T extends A | B> = T["a"];
|
||||
>Y : T["a"]
|
||||
|
||||
type Z<T extends A & B> = T["a"];
|
||||
>Z : T["a"]
|
||||
|
||||
|
||||
|
||||
@@ -2,4 +2,11 @@ class A {
|
||||
private a: number;
|
||||
}
|
||||
|
||||
type B<T extends A> = T["a"];
|
||||
class B {
|
||||
private a: string;
|
||||
}
|
||||
|
||||
type X<T extends A> = T["a"];
|
||||
type Y<T extends A | B> = T["a"];
|
||||
type Z<T extends A & B> = T["a"];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user