Is it possible to consume an enum
from a file being transpiled by babel
using @babel/preset-typescript
?
mymodule.d.ts
declare module 'mymodule' {
export enum Fruit {
apple = 'Apple',
}
}
script.js
import { Fruit } from 'mymodule'
assert.equals(Fruit.apple === 'Apple')
Fruit
will be undefined in this case since babel
does not know about the ambient declaration.
Is there a way to get around this besides declaring a separate enum/constants file and directly importing those in both places (the ambient module and the script)?