[fix] Fix params and parent data types #5974
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #5963, closes #5940 (by introducing the event types, which make proxy generation unnecessary if you use them)
Params
type in most places: It'sPartial<Record<string, any>>
for the generic type because if you don't type it, you don't know which values are on there. It's also needed in case of layouts where params could be present or not present dependening on the child route. This may be a breaking change for people using strict mode, not having explicitly typed the params generic, and accessing it without checking if it's defined.RequestHandler
. Example:export function load(params: PageLoadEvent) {..}
- this makes the generation of proxy JS files unnecessary (proxy files only update on file save and when sync/dev is running, which can be confusing) (PageData types don't update to reflect changes to load function(s) #5940)JSONObject
because of the type limitations we encountered (LayoutServerLoad return type is not compatible with simple interface object #5963). If we use other serialization-methods later, it would be obsolete anywayexport const load: PageLoad<MyOutput> = ..
Please don't delete this checklist! Before submitting the PR, please make sure you do the following:
Tests
pnpm test
and lint the project withpnpm lint
andpnpm check
Changesets
pnpm changeset
and following the prompts. All changesets should bepatch
until SvelteKit 1.0