-
Notifications
You must be signed in to change notification settings - Fork 12.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Namespace missing in generated .d.ts #59470
Comments
No error on the TypeScript side: Playground link |
I tested this on bug workbench again: There is no error. However, the file There is no import declaration for I also tried this with typescript 5.2.2: bug-workbench-5.2.2 |
Confirmed the bug workbench repro locally |
Bisects to #57887 |
Copy-pastable compiler test: // @strict: true
// @declaration: true
// @filename: translation.ts
export interface Translation {
translationKey: Translation.TranslationKeyEnum;
}
export namespace Translation {
export type TranslationKeyEnum = 'translation1' | 'translation2';
export const TranslationKeyEnum = {
Translation1: 'translation1' as TranslationKeyEnum,
Translation2: 'translation2' as TranslationKeyEnum,
}
}
// @filename: test.ts
import { Translation } from "./translation";
import TranslationKeyEnum = Translation.TranslationKeyEnum;
export class Test {
TranslationKeyEnum = TranslationKeyEnum;
print(){
console.log(TranslationKeyEnum.Translation1);
}
}
// @filename: index.ts
import { Test } from "./test";
new Test().print(); |
π Search Terms
namespace missing, import alias namespace missing
π Version & Regression Information
β― Playground Link
https://stackblitz.com/edit/stackblitz-starters-fxkjvu
π» Code
File translation.ts:
File my-lib.component.ts:
π Actual behavior
For the given typescript file, a declaration file translation.d.ts is generated which looks like:
And similar for the component file my-lib.component.d.ts:
This will then create an error when building the application:
π Expected behavior
On previous versions the namespace was also included:
Additional information about the issue
"skipLibCheck": false
The text was updated successfully, but these errors were encountered: