🕗 Version Information
TypeScript v4.1.3 Node.js v10.23.1 linux/amd64
⏯ REPL Link
https://replit.com/@AnmSaiful/ts-import-type-enum
💻 Code
// ---- enums.ts ----
export enum Sex {
Male = "male",
Female = "female",
}
// ---- type.ts ----
export * as Enum from "./enums";
// ---- index.ts ----
import type { Enum } from "./type";
function enumTest(): Enum.Sex {
return Enum.Sex.Male;
}
console.log( enumTest() );
🙁 Actual behavior
It does not allow using Enum from the composed imported type and says:
'Enum' cannot be used as a value because it was imported using 'import type'.
🙂 Expected behavior
It should allow using Enums from the imported type.
import typeto avoid failing ESLint'sno-cyclerule because my type imports result from circular dependency.