Skip to content

Commit 13ee154

Browse files
committed
lateBoundSymbol
1 parent 9eaed03 commit 13ee154

File tree

2 files changed

+454
-0
lines changed

2 files changed

+454
-0
lines changed

internal/execute/tscbuild_test.go

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,63 @@ func TestBuildJavascriptProjectEmit(t *testing.T) {
658658
}
659659
}
660660

661+
func TestBuildLateBoundSymbol(t *testing.T) {
662+
t.Parallel()
663+
testCases := []*tscInput{
664+
{
665+
subScenario: "interface is merged and contains late bound member",
666+
files: FileMap{
667+
"/home/src/workspaces/project/src/globals.d.ts": stringtestutil.Dedent(`
668+
interface SymbolConstructor {
669+
(description?: string | number): symbol;
670+
}
671+
declare var Symbol: SymbolConstructor;
672+
`),
673+
"/home/src/workspaces/project/src/hkt.ts": `export interface HKT<T> { }`,
674+
"/home/src/workspaces/project/src/main.ts": stringtestutil.Dedent(`
675+
import { HKT } from "./hkt";
676+
677+
const sym = Symbol();
678+
679+
declare module "./hkt" {
680+
interface HKT<T> {
681+
[sym]: { a: T }
682+
}
683+
}
684+
const x = 10;
685+
type A = HKT<number>[typeof sym];
686+
`),
687+
"/home/src/workspaces/project/tsconfig.json": stringtestutil.Dedent(`
688+
{
689+
"compilerOptions": {
690+
"rootDir": "src",
691+
"incremental": true,
692+
},
693+
}`),
694+
},
695+
commandLineArgs: []string{"--b", "--verbose"},
696+
edits: []*tscEdit{
697+
{
698+
caption: "incremental-declaration-doesnt-change",
699+
edit: func(sys *testSys) {
700+
sys.replaceFileText("/home/src/workspaces/project/src/main.ts", "const x = 10;", "")
701+
},
702+
},
703+
{
704+
caption: "incremental-declaration-doesnt-change",
705+
edit: func(sys *testSys) {
706+
sys.appendFile("/home/src/workspaces/project/src/main.ts", "const x = 10;")
707+
},
708+
},
709+
},
710+
},
711+
}
712+
713+
for _, test := range testCases {
714+
test.run(t, "lateBoundSymbol")
715+
}
716+
}
717+
661718
func TestBuildSolutionProject(t *testing.T) {
662719
t.Parallel()
663720
testCases := []*tscInput{

0 commit comments

Comments
 (0)