Skip to content

triple-slash reference added only if another triple-slash reference existsΒ #57482

Closed
@dragomirtitian

Description

@dragomirtitian

πŸ”Ž Search Terms

triple-slash reference added

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried

⏯ Playground Link

Workbench

πŸ’» Code

// @declaration: true
// @filename: /a/node_modules/extra/index.d.ts
interface Error2 {
    stack2: string;
}

// @filename: /a/node_modules/something/index.d.ts
/// <reference types="extra" />
// ^ remove above and it will no directive will be added to app.d.ts
export function foo():Error2;

// @filename: /a/app.ts
// reference to extra will be added here if there exists another reference to extra
export function foo() {
    return null! as Error2;
}

πŸ™ Actual behavior

/// <reference types="extra" /> is added to app.d.ts only if another reference directive to extra already exists (in this example one from node_modules)

πŸ™‚ Expected behavior

/// <reference types="extra" /> is always added since extra is required for app.d.ts to be valid

Additional information about the issue

This was discovered while trying to understand reference directives in the context of isolated declarations.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Fix AvailableA PR has been opened for this issuePossible ImprovementThe current behavior isn't wrong, but it's possible to see that it might be better in some cases

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions