ts-api-utils icon indicating copy to clipboard operation
ts-api-utils copied to clipboard

🐛 Bug: Emitted d.ts references internal only typescript types which causes errors in the d.ts file when typechecking

Open sadan4 opened this issue 2 months ago • 3 comments

Bug Report Checklist

  • [x] I have tried restarting my IDE and the issue persists.
  • [x] I have pulled the latest main branch of the repository.
  • [x] I have searched for related issues and found none that matched my issue.

Expected

The emitted d.ts not to reference non-existent types

Actual

The emitted d.t references non-existent types

Additional Info

https://github.com/JoshuaKGoldberg/ts-api-utils/blob/main/typings/typescript.d.ts augments the typescript namespace to include some internal types.

The method in question, https://github.com/JoshuaKGoldberg/ts-api-utils/blob/main/src/flags.ts#L92-L101, is marked with @internal and stripInternal could be enabled to fix this issue.

This makes it impossible to type-check a project without skipLibCheck enabled, as it will always have type errors

sadan4 avatar Oct 03 '25 17:10 sadan4

👍 Makes sense to me, thanks for filing. @kirkwaiblinger @RebeccaStevens WDYT?

I also wonder if we should have some kind of end-to-end types test that runs without skipLibCheck, to stop this kind of error in the future?

JoshuaKGoldberg avatar Oct 06 '25 13:10 JoshuaKGoldberg

one solution i have in mind is to put the internal types in some namespace like #typescript or Typescript_Internal

sadan4 avatar Oct 06 '25 14:10 sadan4

I'm willing to pr a fix to this

sadan4 avatar Oct 06 '25 14:10 sadan4