Invalid bundle generated with module augmentation and path aliases
See original GitHub issueBug report
Input code
Please see this reproducer repo (requires multiple modules): https://github.com/DerGernTod/dts-bundle-generator-aliases
Expected output
export const enum Foo {
BAZ = "baz"
}
export declare const enum Foo {
BAR = "bar"
}
export interface Augmented {
[Foo.BAZ]: string;
}
export interface Augmented {
[Foo.BAR]: string;
}
export {};
Actual output
declare module "@shared/foo" {
const enum Foo {
BAZ = "baz"
}
}
declare module "@shared/foo-map" {
interface Augmented {
[Foo.BAZ]: string;
}
}
export declare const enum Foo {
BAR = "bar"
}
export interface Augmented {
[Foo.BAR]: string;
}
export {};
Additional context Running it with this config:
noCheck: false,
output: {
inlineDeclareGlobals: true,
sortNodes: true,
noBanner: true,
inlineDeclareExternals: true
}
results in the error
dist/type-bundle.d.ts(8,3): error TS1169: A computed property name in an interface must refer to an expression whose type is a literal type or a 'unique symbol' type.
dist/type-bundle.d.ts(8,8): error TS2339: Property 'BAZ' does not exist on type 'typeof Foo'.
Error: Compiled with errors
It generates invalid augmented modules.
Issue Analytics
- State:
- Created a year ago
- Reactions:2
- Comments:5 (4 by maintainers)
Top Results From Across the Web
error TS2664: Invalid module name in augmentation #9748
attempt to use declare module 'jsonschema'; for the jsonschema npm package I get. error TS2664: Invalid module name in augmentation, module ...
Read more >Invalid module name in augmentation -- error while using map ...
In your file .d.ts , just move all the import into the declare module "moduleName" {} .
Read more >TypeScript errors and how to fix them
A list of common TypeScript errors and how to fix them.
Read more >Documentation - Declaration Merging - TypeScript
See Modules for more information. Then the declarations in an augmentation are merged as if they were declared in the same file as...
Read more >@parcel/transformer-css | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
The fix has been released in v6.12.0
Sure, fair enough.