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

feat: TypeScript 5.4 support for svelte-check #2313

Merged
merged 8 commits into from
Mar 19, 2024

Conversation

jasonlyu123
Copy link
Member

@jasonlyu123 jasonlyu123 commented Mar 11, 2024

Auto import seems to be broken. Need to check what the problem is. We also need to check if the Preserved Narrowing in Closures Following Last Assignments changes the narrowing in any unexpected ways (#2316).

Auto Import in non-ts svelte file has some regression in 5.4. So this only adds the support for svelte-check. Editor support waiting on if the upstream fix is merged. So 5.4 might be skipped.

@jasonlyu123 jasonlyu123 added the Blocked Cannot proceed until something else is resolved label Mar 12, 2024
@jasonlyu123
Copy link
Member Author

jasonlyu123 commented Mar 12, 2024

Seems like auto-import is broken in js/non-ts-svelte files importing export default from ts/ts-svelte files. And also declare function like onMount in svelte 3.

@dummdidumm
Copy link
Member

Is this reproducible without Svelte? i.e. import a export default of a .ts file inside a .js file doesn't work? If so, we should open a bug report in the TypeScript repo.

@jasonlyu123
Copy link
Member Author

Yeah. it also happens in js files. Also found that the problem with onMount in svelte 3 isn't because it has a declare modifier. It's because of the barrel export. Barrel export seems like a way bigger problem than the default export. Upstream issue microsoft/TypeScript#57740

@jasonlyu123
Copy link
Member Author

Let's wait until VSCode releases with TypeScript 5.4 to see if enough people complain about it and see if the fix can made into a 5.4 patch release. If not, we can probably either

  1. Adjust the test and add a dedicated test for auto-import reexport/default export. Skipped it and enabled it when the fix was released.
  2. Pin the version in 5.3 but release the fixes with binding control flow and transition type-check.

@dummdidumm
Copy link
Member

dummdidumm commented Mar 16, 2024

The bug was put into the backlog, it doesn't look like it has any priority. We may have to dig into the code base ourselves and make a TS pull request. Would you be willing to try that?
In the meantime doing option 2 sounds good (in fact I already pinned it because I had to release a fix)

@jasonlyu123 jasonlyu123 changed the title feat: TypeScript 5.4 support feat: TypeScript 5.4 support for svelte-check Mar 18, 2024
@jasonlyu123 jasonlyu123 marked this pull request as ready for review March 18, 2024 05:04
@jasonlyu123 jasonlyu123 removed the Blocked Cannot proceed until something else is resolved label Mar 18, 2024
@dummdidumm dummdidumm merged commit 15a41f3 into sveltejs:master Mar 19, 2024
2 checks passed
@jasonlyu123 jasonlyu123 deleted the ts-5.4 branch April 16, 2024 04:48
dummdidumm pushed a commit that referenced this pull request Apr 16, 2024
Follow up to #2313. The auto-import problem is fixed in 5.4.5.
@DePasqualeOrg
Copy link

It looks like the TypeScript version in the svelte-check package still needs to be updated. I'm getting errors when running svelte-check that don't appear in VS Code, where I'm running the latest TypeScript.

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

3 participants