-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
typescript-eslint's "no any" rules don't work with inferred function types from sveltekit #413
Comments
Where are the types for |
sveltekit infers the types so you don't have to annotate them explicitly. i've updated the issue with a github repo. to reproduce the error, checkout that branch then run the following commands
|
Think you mean |
true. i added |
Inferring types is a new feature: https://svelte.dev/blog/zero-config-type-safety |
Thank you for the repo to reproduce. |
memo: Perhaps the following source code is injecting the type. |
Hmm.. We may need new typescript parser for the eslint (not svelte parser). We should check if it integrates well with |
I still have this issue, is there any progress on this, or any known workaround/solution? |
Another minimal repro here: https://github.com/thenbe/repro-eslint-svelte-typecheck Reproduction steps
Expected: We should get no eslint errors.
Other
|
Got the same issue.... So, export async function load({ fetch }) {
return await fetch('/foo');
} this causes an error because |
A workaround is to import the offending type explicitly: import type { RequestEvent } from "./$types";
export async function GET({ url }: RequestEvent) {
return new Response(url.searchParams.get("message")); // no errors
} Which gives correct linting. |
I wasn't sure how to apply this workaround to the minimal repro posted in the comment above. The issue that remains is that eslint fails to see the inferred types not only in the In other words, eslint does not play nice with sveltekit's zero-config-type-safety. |
Before You File a Bug Report Please Confirm You Have Done The Following...
What version of ESLint are you using?
8.33.0
What version of
eslint-plugin-svelte
are you using?2.22.0
What did you do?
Configuration
What did you expect to happen?
no error
What actually happened?
@typescript-eslint/no-unsafe-member-access
errorLink to GitHub Repo with Minimal Reproducible Example
DetachHead/eslint-plugin-svelte-repros@7bf800d
Additional comments
originally raised at #390 (comment)
The text was updated successfully, but these errors were encountered: