TypeScript/tests/cases/fourslash/referencesForUnionProperties.ts
2019-06-13 12:41:21 -07:00

41 lines
1.3 KiB
TypeScript

/// <reference path='fourslash.ts'/>
////interface One {
//// common: { [|[|{| "isDefinition": true, "contextRangeIndex": 0 |}a|]: number;|] };
////}
////
////interface Base {
//// [|[|{| "isDefinition": true, "contextRangeIndex": 2 |}a|]: string;|]
//// b: string;
////}
////
////interface HasAOrB extends Base {
//// [|[|{| "isDefinition": true, "contextRangeIndex": 4 |}a|]: string;|]
//// b: string;
////}
////
////interface Two {
//// common: HasAOrB;
////}
////
////var x : One | Two;
////
////x.common.[|a|];
const [oneDef, one, baseDef, base, hasAOrBDef, hasAOrB, x] = test.ranges();
verify.referenceGroups(one, [
{ definition: "(property) a: number", ranges: [one] },
{ definition: "(property) a: string | number", ranges: [x] },
]);
verify.referenceGroups([base, hasAOrB], [
{ definition: "(property) Base.a: string", ranges: [base] },
{ definition: "(property) HasAOrB.a: string", ranges: [hasAOrB] },
{ definition: "(property) a: string | number", ranges: [x] },
]);
verify.referenceGroups(x, [
{ definition: "(property) a: number", ranges: [one] },
{ definition: "(property) Base.a: string", ranges: [base] },
{ definition: "(property) HasAOrB.a: string", ranges: [hasAOrB] },
{ definition: "(property) a: string | number", ranges: [x] },
]);