Skip to content

Multiple redundant tripleslash directives can be emittedΒ #56590

Closed
@Andarist

Description

@Andarist

πŸ”Ž 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

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