Closed
Description
I experienced the following problem:
Problem
Variables that are imported with import
statement and used in switch
statement with string parameter
are not imported correctly in emitted JavaScript (no import statement emitted for those variables).
Using other types than string in switch
does not cause the problem oddly.
Version
Version 1.8.0-dev.20151112
Code
mod.ts
export const foo = 1;
export const bar = "2";
test.ts
import {foo, bar} from "./mod";
switch ("foo") {
case "foo": {
foo;
}
case "bar": {
bar;
}
}
Command
tsc test.ts --target es6
Output
tsc does not generate import
statement for foo
and bar
.
test.js
switch ("foo") {
case "foo":
foo;
case "bar":
bar;
}