π 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 type
to avoid failing ESLint'sno-cycle
rule because my type imports result from circular dependency. β Limited