-
Notifications
You must be signed in to change notification settings - Fork 12.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolve aliases before using getTypereferenceType
- Loading branch information
Showing
5 changed files
with
243 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
tests/baselines/reference/declarationsForIndirectTypeAliasReference.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
//// [tests/cases/compiler/declarationsForIndirectTypeAliasReference.ts] //// | ||
|
||
//// [b.ts] | ||
export { | ||
Hash, | ||
StringHash, StringHash2 | ||
}; | ||
|
||
interface Hash<T> { | ||
[key: string]: T; | ||
} | ||
|
||
type StringHash = Hash<string>; | ||
|
||
interface StringHash2 extends Hash<string> {} | ||
//// [a.ts] | ||
import {StringHash, StringHash2} from "./b"; | ||
|
||
export { | ||
doSome | ||
} | ||
|
||
const MAP: StringHash = { | ||
a: "a" | ||
}; | ||
|
||
const MAP2: StringHash2 = { | ||
a: "a" | ||
}; | ||
|
||
function doSome(arg1: string, | ||
arg2 = MAP, | ||
arg3 = MAP2) { | ||
} | ||
|
||
//// [b.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
//// [a.js] | ||
"use strict"; | ||
exports.__esModule = true; | ||
var MAP = { | ||
a: "a" | ||
}; | ||
var MAP2 = { | ||
a: "a" | ||
}; | ||
function doSome(arg1, arg2, arg3) { | ||
if (arg2 === void 0) { arg2 = MAP; } | ||
if (arg3 === void 0) { arg3 = MAP2; } | ||
} | ||
exports.doSome = doSome; | ||
|
||
|
||
//// [b.d.ts] | ||
export { Hash, StringHash, StringHash2 }; | ||
interface Hash<T> { | ||
[key: string]: T; | ||
} | ||
declare type StringHash = Hash<string>; | ||
interface StringHash2 extends Hash<string> { | ||
} | ||
//// [a.d.ts] | ||
import { StringHash2 } from "./b"; | ||
export { doSome }; | ||
declare function doSome(arg1: string, arg2?: import("./b").Hash<string>, arg3?: StringHash2): void; |
68 changes: 68 additions & 0 deletions
68
tests/baselines/reference/declarationsForIndirectTypeAliasReference.symbols
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
=== tests/cases/compiler/b.ts === | ||
export { | ||
Hash, | ||
>Hash : Symbol(Hash, Decl(b.ts, 0, 8)) | ||
|
||
StringHash, StringHash2 | ||
>StringHash : Symbol(StringHash, Decl(b.ts, 1, 9)) | ||
>StringHash2 : Symbol(StringHash2, Decl(b.ts, 2, 15)) | ||
|
||
}; | ||
|
||
interface Hash<T> { | ||
>Hash : Symbol(Hash, Decl(b.ts, 3, 2)) | ||
>T : Symbol(T, Decl(b.ts, 5, 15)) | ||
|
||
[key: string]: T; | ||
>key : Symbol(key, Decl(b.ts, 6, 5)) | ||
>T : Symbol(T, Decl(b.ts, 5, 15)) | ||
} | ||
|
||
type StringHash = Hash<string>; | ||
>StringHash : Symbol(StringHash, Decl(b.ts, 7, 1)) | ||
>Hash : Symbol(Hash, Decl(b.ts, 3, 2)) | ||
|
||
interface StringHash2 extends Hash<string> {} | ||
>StringHash2 : Symbol(StringHash2, Decl(b.ts, 9, 31)) | ||
>Hash : Symbol(Hash, Decl(b.ts, 3, 2)) | ||
|
||
=== tests/cases/compiler/a.ts === | ||
import {StringHash, StringHash2} from "./b"; | ||
>StringHash : Symbol(StringHash, Decl(a.ts, 0, 8)) | ||
>StringHash2 : Symbol(StringHash2, Decl(a.ts, 0, 19)) | ||
|
||
export { | ||
doSome | ||
>doSome : Symbol(doSome, Decl(a.ts, 2, 8)) | ||
} | ||
|
||
const MAP: StringHash = { | ||
>MAP : Symbol(MAP, Decl(a.ts, 6, 5)) | ||
>StringHash : Symbol(StringHash, Decl(a.ts, 0, 8)) | ||
|
||
a: "a" | ||
>a : Symbol(a, Decl(a.ts, 6, 25)) | ||
|
||
}; | ||
|
||
const MAP2: StringHash2 = { | ||
>MAP2 : Symbol(MAP2, Decl(a.ts, 10, 5)) | ||
>StringHash2 : Symbol(StringHash2, Decl(a.ts, 0, 19)) | ||
|
||
a: "a" | ||
>a : Symbol(a, Decl(a.ts, 10, 27)) | ||
|
||
}; | ||
|
||
function doSome(arg1: string, | ||
>doSome : Symbol(doSome, Decl(a.ts, 12, 2)) | ||
>arg1 : Symbol(arg1, Decl(a.ts, 14, 16)) | ||
|
||
arg2 = MAP, | ||
>arg2 : Symbol(arg2, Decl(a.ts, 14, 29)) | ||
>MAP : Symbol(MAP, Decl(a.ts, 6, 5)) | ||
|
||
arg3 = MAP2) { | ||
>arg3 : Symbol(arg3, Decl(a.ts, 15, 27)) | ||
>MAP2 : Symbol(MAP2, Decl(a.ts, 10, 5)) | ||
} |
72 changes: 72 additions & 0 deletions
72
tests/baselines/reference/declarationsForIndirectTypeAliasReference.types
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
=== tests/cases/compiler/b.ts === | ||
export { | ||
Hash, | ||
>Hash : any | ||
|
||
StringHash, StringHash2 | ||
>StringHash : any | ||
>StringHash2 : any | ||
|
||
}; | ||
|
||
interface Hash<T> { | ||
>Hash : Hash<T> | ||
>T : T | ||
|
||
[key: string]: T; | ||
>key : string | ||
>T : T | ||
} | ||
|
||
type StringHash = Hash<string>; | ||
>StringHash : Hash<string> | ||
>Hash : Hash<T> | ||
|
||
interface StringHash2 extends Hash<string> {} | ||
>StringHash2 : StringHash2 | ||
>Hash : Hash<T> | ||
|
||
=== tests/cases/compiler/a.ts === | ||
import {StringHash, StringHash2} from "./b"; | ||
>StringHash : any | ||
>StringHash2 : any | ||
|
||
export { | ||
doSome | ||
>doSome : (arg1: string, arg2?: import("tests/cases/compiler/b").Hash<string>, arg3?: StringHash2) => void | ||
} | ||
|
||
const MAP: StringHash = { | ||
>MAP : import("tests/cases/compiler/b").Hash<string> | ||
>StringHash : import("tests/cases/compiler/b").Hash<string> | ||
>{ a: "a"} : { a: string; } | ||
|
||
a: "a" | ||
>a : string | ||
>"a" : "a" | ||
|
||
}; | ||
|
||
const MAP2: StringHash2 = { | ||
>MAP2 : StringHash2 | ||
>StringHash2 : StringHash2 | ||
>{ a: "a"} : { a: string; } | ||
|
||
a: "a" | ||
>a : string | ||
>"a" : "a" | ||
|
||
}; | ||
|
||
function doSome(arg1: string, | ||
>doSome : (arg1: string, arg2?: import("tests/cases/compiler/b").Hash<string>, arg3?: StringHash2) => void | ||
>arg1 : string | ||
|
||
arg2 = MAP, | ||
>arg2 : import("tests/cases/compiler/b").Hash<string> | ||
>MAP : import("tests/cases/compiler/b").Hash<string> | ||
|
||
arg3 = MAP2) { | ||
>arg3 : StringHash2 | ||
>MAP2 : StringHash2 | ||
} |
33 changes: 33 additions & 0 deletions
33
tests/cases/compiler/declarationsForIndirectTypeAliasReference.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// @declaration: true | ||
// @filename: b.ts | ||
export { | ||
Hash, | ||
StringHash, StringHash2 | ||
}; | ||
|
||
interface Hash<T> { | ||
[key: string]: T; | ||
} | ||
|
||
type StringHash = Hash<string>; | ||
|
||
interface StringHash2 extends Hash<string> {} | ||
// @filename: a.ts | ||
import {StringHash, StringHash2} from "./b"; | ||
|
||
export { | ||
doSome | ||
} | ||
|
||
const MAP: StringHash = { | ||
a: "a" | ||
}; | ||
|
||
const MAP2: StringHash2 = { | ||
a: "a" | ||
}; | ||
|
||
function doSome(arg1: string, | ||
arg2 = MAP, | ||
arg3 = MAP2) { | ||
} |