Skip to content

Multiple redundant tripleslash directives can be emitted #56590

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

Closed
Andarist opened this issue Nov 29, 2023 · 0 comments Β· Fixed by #57681
Closed

Multiple redundant tripleslash directives can be emitted #56590

Andarist opened this issue Nov 29, 2023 · 0 comments Β· Fixed by #57681
Labels
Bug A bug in TypeScript Fix Available A PR has been opened for this issue Help Wanted You can do this
Milestone

Comments

@Andarist
Copy link
Contributor

πŸ”Ž Search Terms

tripleslash directive modules reference

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

https://www.typescriptlang.org/play?target=99&moduleResolution=3&module=100&esModuleInterop=false#code/PTAEAEFsHsBMFcA2BTAXKAcnZBGAbALABQIEMCKASsgM7SLwAuAltAHbpay6EljjcAxogCGAJxEt26RmPjJixEGAA8Y5ADNk6toOShGATwAOtALwAiNtguhgAPkVFmkY9DGNQAbwCqlADIAvqAaYtCQoADk1tyo8GKIkQDcxC5uHt4AogBuyGyMmZDMjIzawaHhUTFoyLn5NMmpru6eXgBC8BpaYuVhEdHYqABGnd2NRMTIAB7pnoLsNJ6Lo+gA2n7+APwANKA5eQVFJdo7oB1dJwC6oGagq2zIAO6gGwAUkQAWJcY0qCCPAIAdEZTDRBGJmMZGKI2ABzQHuWHAYyiQyRACUlyAA

πŸ’» Code

// @module: Node16
// @moduleResolution: Node16
// @declaration: true

/// <reference types="node" />

import {URL} from 'node:url';
import {EventEmitter} from 'node:events';
import {Buffer} from 'node:buffer';

export const stuff: [URL?, EventEmitter?, Buffer?] = [new URL('https://www.typescriptlang.org/play')]

πŸ™ Actual behavior

/// <reference types="node" resolution-mode="require"/>
/// <reference types="node" resolution-mode="require"/>
/// <reference types="node/url.js" />
/// <reference types="node/ts4.8/url.js" />
/// <reference types="node/events.js" />
/// <reference types="node/ts4.8/events.js" />
/// <reference types="node/buffer.js" />
/// <reference types="node/ts4.8/buffer.js" />
import { URL } from 'node:url';
import { EventEmitter } from 'node:events';
import { Buffer } from 'node:buffer';
export declare const stuff: [URL?, EventEmitter?, Buffer?];

πŸ™‚ Expected behavior

I'd expect only a single /// <reference types="node" resolution-mode="require"/> to be emitted.

Additional information about the issue

Note that types acquisition and switching between ESM/CJS modes is a little bit unreliable in the TS playground so you might have to "touch" the repro to "refresh" the DTS output

@RyanCavanaugh RyanCavanaugh added Bug A bug in TypeScript Help Wanted You can do this labels Dec 1, 2023
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Dec 1, 2023
@typescript-bot typescript-bot added the Fix Available A PR has been opened for this issue label Mar 20, 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 Fix Available A PR has been opened for this issue Help Wanted You can do this
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants