Skip to content

Commit 7012959

Browse files
committed
chore: extra test for type-only
1 parent 6fcd94d commit 7012959

4 files changed

+57
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
//// [tests/cases/compiler/isolatedModulesImportConstEnumTypeOnly.ts] ////
2+
3+
//// [enum.ts]
4+
export const enum Foo { Bar }
5+
6+
//// [index.ts]
7+
import { Foo } from "./enum";
8+
function f(foo: Foo) { return; }
9+
10+
11+
//// [enum.js]
12+
"use strict";
13+
exports.__esModule = true;
14+
exports.Foo = void 0;
15+
var Foo;
16+
(function (Foo) {
17+
Foo[Foo["Bar"] = 0] = "Bar";
18+
})(Foo = exports.Foo || (exports.Foo = {}));
19+
//// [index.js]
20+
"use strict";
21+
exports.__esModule = true;
22+
function f(foo) { return; }
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
=== tests/cases/compiler/enum.ts ===
2+
export const enum Foo { Bar }
3+
>Foo : Symbol(Foo, Decl(enum.ts, 0, 0))
4+
>Bar : Symbol(Foo.Bar, Decl(enum.ts, 0, 23))
5+
6+
=== tests/cases/compiler/index.ts ===
7+
import { Foo } from "./enum";
8+
>Foo : Symbol(Foo, Decl(index.ts, 0, 8))
9+
10+
function f(foo: Foo) { return; }
11+
>f : Symbol(f, Decl(index.ts, 0, 29))
12+
>foo : Symbol(foo, Decl(index.ts, 1, 11))
13+
>Foo : Symbol(Foo, Decl(index.ts, 0, 8))
14+
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
=== tests/cases/compiler/enum.ts ===
2+
export const enum Foo { Bar }
3+
>Foo : Foo
4+
>Bar : Foo.Bar
5+
6+
=== tests/cases/compiler/index.ts ===
7+
import { Foo } from "./enum";
8+
>Foo : typeof Foo
9+
10+
function f(foo: Foo) { return; }
11+
>f : (foo: Foo) => void
12+
>foo : Foo
13+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// @isolatedModules: true
2+
3+
// @filename: enum.ts
4+
export const enum Foo { Bar }
5+
6+
// @filename: index.ts
7+
import { Foo } from "./enum";
8+
function f(foo: Foo) { return; }

0 commit comments

Comments
 (0)