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

chore: move typescript to svelte-check's peer dependency #1860

Closed
wants to merge 1 commit into from

Conversation

Andarist
Copy link

@Andarist Andarist commented Feb 9, 2023

It is kinda debatable but I feel that it's better to use the installed version of typescript. I just had to go through a surprising debugging session since my IDE was using TypeScript 4.8 but svelte-check was using TypeScript 4.5 (I had an old version that had the * range declared on typescript and TS 4.5 was left in the lockfile from before the rest of the monorepo bumped TS to TS 4.8.

I understand that this might create a different problem though - now the svelte-check might run with a different version of TS than the VS Code extension. However, this isn't a new problem - it already exists.

@dummdidumm
Copy link
Member

I'm very hesitant to merge this. Having it as a peer dependency allows us to make use of new TypeScript constructs without having to release a major version svelte-check. It doesn't happen often but it did before.

@Andarist
Copy link
Author

Andarist commented Feb 9, 2023

From my PoV it's important to consider user expectations here.

Scenario 1:

  1. I upgrade my project to TS 5.0 (the version itself doesn't really matter, it's just an example) and I start using const type parameters
  2. Can I expect svelte-check to handle this new syntax? And this isn't even about new syntax - any TS version can change the type checking behavior. Is it expected that I don't get any errors when running tsc or in the IDE (in my regular TS files) or is it expected that I can run into problems here? Is this caveat communicated in the docs anyhow?

Scenario 2:

  1. I upgrade svelte-check and it starts using TS 5.0 with its more strict relational operators
  2. Is it expected that I start getting new errors for the existing code only when running through svelte-check?

without having to release a major version svelte-check

What's the problem with new major versions though? They are honest and convey the intent nicely. It's just like an age - it's just a number 😉

@DavidArchibald
Copy link
Contributor

DavidArchibald commented Jul 24, 2024

I can second that I ran into this problem and it was an annoying surprise. I was going to file this as an issue myself!

For others running into this, I ended up solving this by adding this to my package.json file

    "resolutions": {
        "typescript": "^5.5.4"
    }

But it was only after I digged into the source itself that I realised it was bundling the TypeScript version and just about filed an issue myself.

},
"peerDependencies": {
"svelte": "^3.55.0"
"svelte": "^3.55.0",
"typescript": "^4.9.0"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be updated to allow Typescript 5 to be used as well

Suggested change
"typescript": "^4.9.0"
"typescript": ">=4.9.0"

@dummdidumm
Copy link
Member

Closing in favor of #2453

@dummdidumm dummdidumm closed this Jul 31, 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

Successfully merging this pull request may close these issues.

None yet

4 participants