镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Multiple redundant tripleslash directives can be emitted #56590

Closed

Description

🔎 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptFix AvailableA PR has been opened for this issueHelp WantedYou can do this

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions