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

TSC version 5.5.3 - output file looses triple slash reference comment hence compilation fails #59094

Closed
dbaeumer opened this issue Jul 1, 2024 · 4 comments
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@dbaeumer
Copy link
Member

dbaeumer commented Jul 1, 2024

πŸ”Ž Search Terms

tripple slash reference path

πŸ•— Version & Regression Information

  • This changed between versions 5.4.5 and 5.5.3

⏯ Playground Link

No response

πŸ’» Code

Steps to reproduce:

See everything compiles correctly and the p1/lib/common/api.d.ts file has a /// reference comment at the top

  • run git clean -xfd .
  • open package.json file in the workspace root and change the typescript dependency from ^5.4.5 to ^5.5.3
  • npm install
  • cd p1
  • npm run compile

πŸ™ Actual behavior

The compile fails complaining about the missing Thenable in lib/common/api.d.ts

lib/common/api.d.ts:1:32 - error TS2304: Cannot find name 'Thenable'.

1 export declare function foo(): Thenable<string>;

Also observe that the p1/lib/common/api.d.ts file has NO /// reference comment at the top

πŸ™‚ Expected behavior

Code compiles like it did under 5.4.5

Additional information about the issue

No response

@MartinJohns
Copy link
Contributor

@jakebailey
Copy link
Member

Yes, this is working as designed. Add preserve="true" to directives you intend to be included in the compiled output.

@DanielRosenwasser DanielRosenwasser added the Working as Intended The behavior described is the intended behavior; this is not a bug label Jul 1, 2024
@jakebailey
Copy link
Member

Based on the example and the project where it came from (https://github.com/microsoft/vscode-languageserver-node/blob/6d2a392547ea60db1723e027b4b55d268aa282ea/server/typings/thenable.d.ts), this could just be a type defined and imported, which would end up being handled properly. (Not sure why it's a global...)

@dbaeumer
Copy link
Member Author

dbaeumer commented Jul 2, 2024

@jakebailey good question. It has always been that way I and don't really know why we went down that path 10 years ago ;-). I will look what the best way to fix it is.

@dbaeumer dbaeumer closed this as completed Jul 2, 2024
@dbaeumer dbaeumer changed the title TSC version 5.5.3 - output file looses tripple slash reference comment hence compilation fails TSC version 5.5.3 - output file looses triple slash reference comment hence compilation fails Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

4 participants