Skip to content
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

TypeScript generates invalid types if @import tags are spread over multiple lines #59011

Open
remcohaszing opened this issue Jun 25, 2024 · 0 comments · May be fixed by #59026
Open

TypeScript generates invalid types if @import tags are spread over multiple lines #59011

remcohaszing opened this issue Jun 25, 2024 · 0 comments · May be fixed by #59026
Labels
Bug A bug in TypeScript Domain: Declaration Emit The issue relates to the emission of d.ts files Domain: JavaScript The issue relates to JavaScript specifically Domain: JSDoc Relates to JSDoc parsing and type generation Fix Available A PR has been opened for this issue

Comments

@remcohaszing
Copy link

🔎 Search Terms

“import”

🕗 Version & Regression Information

  • This changed between versions 5.4 and 5.5
  • I was unable to test this on prior versions because this feature was introduced in TypeScript 5.5

⏯ Playground Link

https://github.com/remcohaszing/typescript-jsdoc-import-bug

💻 Code

/**
 * @import {
 *   Program
 * } from 'estree'
 */

/**
 * @param {Program} program
 */
export function compile(program) {}

🙁 Actual behavior

TypeScript emits the following type invalid definition:

/**
 * @import {
 *   Program
 * } from 'estree'
 */
/**
 * @param {Program} program
 */
export function compile(program: *   Program): void;
import type { Program } from 'estree';

🙂 Expected behavior

TypeScript emits the following valid type definition:

/**
 * @import {
 *   Program
 * } from 'estree'
 */
/**
 * @param {Program} program
 */
export function compile(program: Program): void;
import type { Program } from 'estree';

Additional information about the issue

This bug does not appear in the playground, only when running tsc locally.

@DanielRosenwasser DanielRosenwasser added this to the TypeScript 5.5.3 milestone Jun 26, 2024
@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript Domain: JSDoc Relates to JSDoc parsing and type generation Domain: Declaration Emit The issue relates to the emission of d.ts files Domain: JavaScript The issue relates to JavaScript specifically labels Jun 26, 2024
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Jun 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Declaration Emit The issue relates to the emission of d.ts files Domain: JavaScript The issue relates to JavaScript specifically Domain: JSDoc Relates to JSDoc parsing and type generation Fix Available A PR has been opened for this issue
Projects
None yet
3 participants