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

refactor: Make TS a peer dep #1798

Merged
merged 2 commits into from
Jul 6, 2023
Merged

refactor: Make TS a peer dep #1798

merged 2 commits into from
Jul 6, 2023

Conversation

rschristian
Copy link
Member

What kind of change does this PR introduce?

Refactor

Did you add tests for your changes?

N/A

Summary

Makes TypeScript an optional peer dependency, rather than a direct dependency.

TS was originally added as a dependency here as part of the TypeScript support. However, today we only rely on TS to support the TS checker plugin, which only runs if the user has a tsconfig.json. This makes it a perfect optional peer dependency.

As for why this is needed, it's to better address #1797. Preact has began to use very new TypeScript lib types (preactjs/preact#4023) which necessitate using newer TypeScript releases. preact-cli will prioritize it's own dependencies over user-installed ones (to avoid conflicts, especially with Webpack plugin versions), so it'd be ideal if we relinquish control over TypeScript versioning entirely, leaving it up to the user.

Does this PR introduce a breaking change?

Nothing should break except in the case someone uses TypeScript (has a tsconfig.json in their project), but doesn't have TS listed as a dependency.

They should have TS listed as a dep anyhow (we do in all of our templates and it's pretty standard behavior), so I'm fine with that, even if it is a tiny breakage.

@rschristian rschristian requested a review from a team as a code owner July 4, 2023 00:02
@changeset-bot
Copy link

changeset-bot bot commented Jul 4, 2023

🦋 Changeset detected

Latest commit: 4eb1330

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
preact-cli Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@rschristian rschristian merged commit 96fc0f3 into master Jul 6, 2023
@rschristian rschristian deleted the refactor/ts-peer-dep branch July 6, 2023 03:07
@preact-bot preact-bot mentioned this pull request Jul 6, 2023
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

Successfully merging this pull request may close these issues.

1 participant