You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Open the app in any browser, and you'll see 'undefined' printed into the terminal as the result of console.log(typeof event.platform) from hooks.server.ts
VSCode believes the type of event.platform to be Readonly or Readonly<{}>, meaning the below fails TS because 'something' doesn't exist on event.platform (correct) but it doesn't catch that event.platform is maybe undefined
Describe the bug
In the docs (here) the default type for Platform is
{}
, but in dev it is coming through as undefined.This makes type safety harder, since TS doesn't enforce an is-object check before attempting to access properties.
My preference would like to default Platform to an empty object, rather than updating the type to allow undefined.
This is an issue for us since adapter-node will only apply during production builds and as such during dev the Platform object is undefined.
Reproduction
Open repo https://github.com/chrskerr/sveltekit-platform-demo, and start in dev mode
Open the app in any browser, and you'll see 'undefined' printed into the terminal as the result of
console.log(typeof event.platform)
from hooks.server.tsVSCode believes the type of event.platform to be Readonly or Readonly<{}>, meaning the below fails TS because 'something' doesn't exist on event.platform (correct) but it doesn't catch that event.platform is maybe undefined
Logs
No response
System Info
Severity
annoyance
Additional Information
No response
The text was updated successfully, but these errors were encountered: