-
-
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
Module '"@sveltejs/kit"' declares 'RequestEvent' locally, but it is not exported #4805
Comments
Easy change. Happy to open a PR if a maintainer is okay with this being an exported type. (I would think it should be, since it's part of a public API.) |
Thanks! |
Seems reasonable enough to me There was a desire to only expose what was necessary and start out with stuff being private. Your use case seems to make sense to me though. And we exposed some other stuff in #4461 |
Ben, I'll take care of this and open a PR today. More widely, it seems to me like the input and return types of the public API should all be exposed to the user. From a TypeScript perspective, it's always a frustrating user experience to have access to an exported API but not have access to that API's input and output types. From a dependency perspective, I don't think it makes a difference either way -- whether you expose the type publicly or not, users are still depending on the implicit type, so why not make it easier on them? 🙂 Would you like me to audit the exported function types for functions with unexported input/output types and create an issue for discussion if there are any remaining? |
Should be closed by #4809. |
I'd like to second @tcc-sejohnson here.
This is, word by word, what makes (to me at least) currently uneasy working with TS in Svelte Kit. It's OK that the framework itself is not a TypeScript first framework, but to those that would like to use it in a type safe env, these improvements would make our lives easier. |
Just a comment for reference: I got this exact problem today from the get-go building the boilerplate project suggested by kit.svelte.dev
then
Edit: tag self @delhanty for future issue "mentioned" search. |
Can you be clearer about what the boilerplate project is? Did you run |
Yes I chose "SvelteKit demo app" and then
If it makes a difference, I develop with pnpm. (With pnpm v7,
As an aside, there were also Prettier issues with |
Oh, there are also other
|
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
Thanks for the bug reports. I filed them as new issues in #4937 and #4938. I collapsed the comments here in favor of those issues to keep this thread from getting off-topic
When you run it, it tells you to do
It is. That's what's run when you do |
Describe the bug
Getting a TypeScript warning
Module '"@sveltejs/kit"' declares 'RequestEvent' locally, but it is not exported
for this line of code...Why do I need it? I have two functions in my hooks.ts called from handle() that pass the event as a parameter...
Not sure if there was a recent change but my code has been in place for some time.
Reproduction
See code above...
Logs
No response
System Info
Severity
annoyance
Additional Information
My code works but the warning is a little annoying. More importantly, I think there is value for the RequestEvent type. Would be great to have it exported like Handle and GetSession.
The text was updated successfully, but these errors were encountered: