Microsoft/TypeScript
GitHub ã§èŠãEmitted declarations for JS file do not import a class if it's re-exported
Open
#61,718 opened on 2025幎5æ17æ¥
BugDomain: Declaration EmitHelp Wanted
Repository metrics
- Stars
- Â (48,455 stars)
- PR merge metrics
-  (å¹³åããŒãž 6d 17h) (30d ã§ 9 merged PRs)
説æ
ð Search Terms
import export class declarations
ð Version & Regression Information
This changed in PR #55472, commit 5ce34cafad, version 5.3.0-dev.20230829.
⯠Playground Link
No response
ð» Code
index.js:
import { Something } from './something';
export { Something } from './something';
export const something = new Something();
something.ts (or something.js):
export class Something {}
tsconfig.json:
{
"compilerOptions": {
"checkJs": true,
"declaration": true,
"outDir": "dist"
}
}
ð Actual behavior
The import of Something is missing in the emitted declarations file index.d.ts:
export { Something } from "./something";
export const something: Something;
ð Expected behavior
The import of Something should be included in the emitted declarations file index.d.ts:
export { Something } from "./something";
export const something: Something;
import { Something } from './something';
Additional information about the issue
The problem does not occur if
- the file name is
index.tsinstead ofindex.js export const somethingincludes an explicit JSDoc type annotation (/** @type {Something} */)