I'd like to provide a simpler interface in my library (in a React application) for exported members of another library (monaco-editor in this case). For this I created an index.ts file which does re-export a number of types, where I removed an inner namespace. This works nicely:
import { languages } from "monaco-editor/esm/vs/editor/editor.api";
export type FoldingRange = languages.FoldingRange;
export type FoldingContext = languages.FoldingContext;
export type FoldingRangeKind = languages.FoldingRangeKind;
except for the last line, because FoldingRangeKind is an enum. I cannot use export enum here as that expects a full enum definition.
Another option would be:
export import FoldingRangeKind = languages.FoldingRangeKind;
but unfortunately, this is not accepted by Babel. It results in this error:
import =
is not supported by @babel/plugin-transform-typescript Please consider usingimport from '';` alongside Typescript's --allowSyntheticDefaultImports option.
A default import wouldn't help here, so I wonder what to do instead.