dts-bundle-generator
dts-bundle-generator copied to clipboard
Output strips `type` keyword from type import
Bug report
The generator seems to remove the type import keyword from the source, this can be troublesome for projects that have verbatimModuleSyntax enabled:
error TS1484: 'MyType' is a type and must be imported using a type-only import when 'verbatimModuleSyntax' is enabled.
I'd be happy to take a stab at this issue if there isn't anything I can use to get this working. Both the project that's compiling this has the type, and the project using the type has verbatimModuleSyntax enabled.
Input code
import type { MyType } from "@my-internal-lib/some-type";
export type MyExportedType = {
property: MyType;
};
declare global {
// type augmentation
}
Expected output
import type { MyType } from "@my-internal-lib/some-type";
export type MyExportedType = {
property: MyType;
};
declare global {
// type augmentation
}
Actual output
import { MyType } from "@my-internal-lib/some-type";
export type MyExportedType = {
property: MyType;
};
declare global {
// type augmentation
}
Additional context
I am using the JS API and here are my options:
generateDtsBundle([
{
filePath: String(entry),
outFile: output,
output: { inlineDeclareGlobals: true },
},
])
Duplicate of https://github.com/timocov/dts-bundle-generator/issues/290
Hm, actually, if it just about imports, it could be different issue and probably can be solved separately. I'll check in couple of days what we can do.
Took a stab at this @timocov https://github.com/timocov/dts-bundle-generator/pull/321