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

Mark typescript as peerDependency #324

Open
Q16solver opened this issue May 18, 2024 · 3 comments
Open

Mark typescript as peerDependency #324

Q16solver opened this issue May 18, 2024 · 3 comments

Comments

@Q16solver
Copy link

Q16solver commented May 18, 2024

Bug report

Hello! Recently, ts 5.5 was announced in beta with new feature https://devblogs.microsoft.com/typescript/announcing-typescript-5-5-beta/#the-configdir-template-variable-for-configuration-files
This lets us share tsconfig across packages, and I wanted to use it for my monorepo, but dts-bundle-generator gives me error saying it cannot find the imports in my library code. I think it's because the dependency isn't correct? I'm not sure what the standard way is to solve it here, I can think of perhaps 2 ways:

  • Have a "next" branch that ups the deps to the beta version as well and simply just publish it as an alpha/beta
  • Have the typescript dep as a peerDep? and have userland install the required version? I'm not sure if that actually works, just a thought

For reference I used with typescript ver: "5.5.0-dev.20240518",
shared config: https://github.com/Esposter/Esposter/tree/shared-configuration/packages/configuration
usage: https://github.com/Esposter/Esposter/blob/shared-configuration/packages/shared/tsconfig.build.json

@timocov
Copy link
Owner

timocov commented May 20, 2024

Hey @Q16solver,

but dts-bundle-generator gives me error saying it cannot find the imports in my library code

can you share what exactly does not work? I just tried the latest version of typescript simply adding ${configDir} in the config and it seems working fine (similar to the link you shared). If you have a minimal repro of your issue it would be much appreciated.

@Q16solver
Copy link
Author

@timocov Yep sure! Here's the minimal repro https://stackblitz.com/edit/github-hlcarv-yvtyug?file=tsconfig.build.json,tsconfig.json,package.json,src%2Findex.ts
Please run pnpm types:gen for the issue.
It complains that it cannot find the imports when I have ${configDir}, but once I remove that from the tsconfig.json, it successfully outputs dist/index.d.ts as normal

@timocov
Copy link
Owner

timocov commented Jun 15, 2024

Thanks @Q16solver!

Have the typescript dep as a peerDep? and have userland install the required version? I'm not sure if that actually works, just a thought

I checked other similar repos and it seems this is the way to go. But I think this would be a breaking change tho.

Would you like to create a PR?

@timocov timocov added the Bug label Jun 15, 2024
@timocov timocov changed the title Support ts 5.5 tsconfig.json with ${configDir} Mark typescript as peerDependency Jun 15, 2024
@timocov timocov added this to the 10.0 milestone Jun 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants