-
-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Update request type definitions to make platform possibly undefined #8232
Conversation
@chrskerr is attempting to deploy a commit to the Svelte Team on Vercel. A member of the Team first needs to authorize it. |
🦋 Changeset detectedLatest commit: b3f172c The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Thanks for the PR! I think the proposed alternative (making Obviously the real solution is to populate |
No problems :) I had hoped that this PR would ensure that Something like the below? The goal being to allow platform itself to be undefined (this pr) and also to ensure that adapter specific keys are definitely optional. // packages/kit/types/index.d.ts
export interface RequestEvent<
Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
RouteId extends string | null = string | null
> {
...
platform: Readonly<App.Platform>;
} to: // packages/kit/types/index.d.ts
export interface RequestEvent<
Params extends Partial<Record<string, string>> = Partial<Record<string, string>>,
RouteId extends string | null = string | null
> {
...
platform: Partial<Readonly<App.Platform>> | undefined;
} |
I think |
Yeah that makes sense to me, I imagine that I should also revert my change to Which would mean that the platform object is either undefined (not supplied by adapter or dev mode), or it is exactly as described by the adapter. If happy with this approach, then I can update the PR today :) |
thank you! |
Co-authored-by: Conduitry <git@chor.date>
This PR is to resolve issue #8230 in which the platform object does not match it's types.
event.platform
is typed as an empty object by default so I am changing the server response to fallback to this rather than allowing it to be undefined.An alternative could be to update the types to make platform optional within event.
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