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

/// <reference lib is stripped out of d.ts file #58956

Closed
SimenB opened this issue Jun 21, 2024 · 2 comments
Closed

/// <reference lib is stripped out of d.ts file #58956

SimenB opened this issue Jun 21, 2024 · 2 comments

Comments

@SimenB
Copy link

SimenB commented Jun 21, 2024

πŸ”Ž Search Terms

reference lib elided disposable

πŸ•— Version & Regression Information

  • This changed between versions 5.4.5 and 5.5.2

(not fixed in nightly)

⏯ Playground Link

https://www.typescriptlang.org/play/?ts=5.5.2#code/PQgEB4CcFMDNpgOwMbVAGwJYCMC8AiaAZ0WgA8AXAOgBNMiAHAeyIENt1p9RgA+AKH7lmkCqEyIKCWK1SgAKgAsJAc1DkpiGkVAAReszYc0AbwC+QA

πŸ’» Code

/// <reference lib="esnext.disposable" />

export interface Thing extends Disposable {}

πŸ™ Actual behavior

Output d.ts is

export interface Thing extends Disposable {
}

πŸ™‚ Expected behavior

The .d.ts file should be like it was in 5.4.5

/// <reference lib="esnext.disposable" />
export interface Thing extends Disposable {
}

Additional information about the issue

No response

@jakebailey
Copy link
Member

This is by design: https://devblogs.microsoft.com/typescript/announcing-typescript-5-5/#simplified-reference-directive-declaration-emit

Changed in #57681.

You must now write:

/// <reference lib="esnext.disposable" preserve="true" />

@SimenB
Copy link
Author

SimenB commented Jun 21, 2024

Ah, somehow missed that. Thanks!

An awesome change - I have some code when building definition files I can probably delete, then.

https://github.com/jestjs/jest/blob/046787eafae9ea0515b19e81f30758e0f040f077/scripts/buildTs.mjs#L205-L232

@SimenB SimenB closed this as not planned Won't fix, can't repro, duplicate, stale Jun 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants