Skip to content

Use Component#330

Open
pjaudiomv wants to merge 8 commits intoItalyPaleAle:mainfrom
pjaudiomv:main
Open

Use Component#330
pjaudiomv wants to merge 8 commits intoItalyPaleAle:mainfrom
pjaudiomv:main

Conversation

@pjaudiomv
Copy link

@pjaudiomv pjaudiomv commented Nov 3, 2024

Fixes #329

This has been updated from ComponentType here https://svelte.dev/docs/svelte/typescript#The-Component-type

See sveltejs/svelte#11775 for additional background

This is basically adjustment of #315

Update Router.d.ts type for svelte5
- Remove on:routeEvent from component template (no longer supported in Svelte 5)
- Add event callback props (onconditionsFailed, onrouteLoading, onrouteLoaded)
- Update dispatchNextTick to call both dispatcher and callback props
- Update TypeScript definitions for Svelte 5 component model
- Update package.json version to 5.0.0 and description for Svelte 5
- Update README and Advanced Usage docs for Svelte 5 syntax
- Add MIGRATION_SVELTE5.md guide for users upgrading from Svelte 4

Breaking changes:
- Event handlers now use prop syntax (onconditionsFailed vs on:conditionsFailed)
- routeEvent mechanism removed (use callback props or stores instead)
Renamed local 'props' variable to 'componentProps' to avoid conflict with
RouteItem.props property, which was causing 'can't access lexical declaration
before initialization' error in Svelte 5.
Convert component, componentParams, componentProps, previousScrollState,
lastLoc, and componentObj to use $state rune for proper reactivity in Svelte 5.
Remove $state from lastLoc and componentObj as they are used for
comparisons with non-state values and don't need to be reactive.
This fixes the state_proxy_equality_mismatch warnings in Svelte 5.
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.

TS Type mismatch for components

1 participant