We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Just upgraded to Svelte 5 and I'm getting type errors for some stores-only code (.ts file).
.ts
import { derived, readable, writable, type Updater, type Writable } from "svelte/store" import { page } from "$app/stores" import { browser } from "$app/environment" import deepEquals from "fast-deep-equal" let oldState: App.PageState = {} export const pageState = derived<typeof page, App.PageState>( page, (_, set) => { if (!browser) return setTimeout(() => { const newState = history.state["sveltekit:states"] ?? {} if (!deepEquals(oldState, newState)) { oldState = newState set(newState) } }) }, {}, )
Manually type the arrow function - replace _, set with:
_, set
_: typeof page extends Readable<infer U> ? U : never, set: (value: App.PageState) => void)
$ tsc --noEmit true src/lib/stores.ts:13:6 - error TS7006: Parameter '_' implicitly has an 'any' type. 13 (_, set) => { ~ src/lib/stores.ts:13:9 - error TS7006: Parameter 'set' implicitly has an 'any' type. 13 (_, set) => {
System: OS: Windows 10 10.0.19045 CPU: (20) x64 12th Gen Intel(R) Core(TM) i7-12700KF Memory: 13.10 GB / 31.86 GB Binaries: Node: 20.8.0 - C:\Program Files\nodejs\node.EXE Yarn: 4.1.1 - C:\Program Files\nodejs\yarn.CMD npm: 10.2.1 - C:\Program Files\nodejs\npm.CMD Browsers: Edge: Spartan (44.19041.1266.0) Internet Explorer: 11.0.19041.1566
annoyance
The text was updated successfully, but these errors were encountered:
I get it when using svelte-check: sveltejs/language-tools#2359
It could be a regression: #8699
Sorry, something went wrong.
fix: adjust order of derived function definition overloads
derived
44f23d2
Turns out the order is crucial for not getting a type error fixes #11415
fix: adjust order of derived function definition overloads (#11426)
9c1a506
Successfully merging a pull request may close this issue.
Describe the bug
Just upgraded to Svelte 5 and I'm getting type errors for some stores-only code (
.ts
file).Reproduction
Workaround
Manually type the arrow function - replace
_, set
with:Logs
System Info
Severity
annoyance
The text was updated successfully, but these errors were encountered: