Skip to content

Emitted declarations for JS file do not import a class if it's re-exported #61718

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

Open
keijokapp opened this issue May 17, 2025 · 0 comments
Open
Labels
Bug A bug in TypeScript Help Wanted You can do this
Milestone

Comments

@keijokapp
Copy link

keijokapp commented May 17, 2025

πŸ”Ž Search Terms

import export class declarations

πŸ•— Version & Regression Information

This changed in PR #55472, commit 5ce34ca, 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.ts instead of index.js
  • export const something includes an explicit JSDoc type annotation (/** @type {Something} */)
@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Help Wanted You can do this labels May 19, 2025
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone May 19, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Help Wanted You can do this
Projects
None yet
Development

No branches or pull requests

2 participants
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy