Closed orgads closed 2 months ago
@orgads You're trying to import a TS file as if its a JS file. Changing import { MyEnum } from './enums.js';
to import { MyEnum } from './enums.ts';
or import { MyEnum } from './enums';
should fix it
This is how imports are done in esm. This project is cjs, but the imports are esm compatible.
Changing it to .ts
won't work.
Enums are only supported in Typescript, so the enum
file would have to be enum.ts
. I dont think you can import a ts file using a js
extension can you?
Yes you can, See here.
And enums are transpiled to:
var MyEnum;
(function (MyEnum) {
MyEnum["VAL1"] = "Val1";
MyEnum["VAL2"] = "Val2";
})(MyEnum || (exports.MyEnum = MyEnum = {}));
Got it, thanks for clearing up, havent seen it before. Any chance you can provide a simple reproduction repo and ill add support for it?
Thanks @orgads will look this weekend
Fixed in v9.4.2 let me know if you have any more issues
enums.ts:
schema.ts:
Error: