Closed
Description
Before You File a Bug Report Please Confirm You Have Done The Following...
- I have tried restarting my IDE and the issue persists.
- I have updated to the latest version of the packages.
What version of ESLint are you using?
8.39.0
What version of eslint-plugin-svelte
are you using?
2.26.0
What did you do?
This error only happens when enabling 'plugin:@typescript-eslint/recommended-requiring-type-checking'
.
Configuration
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
extends: [
'eslint:recommended',
'plugin:@typescript-eslint/recommended',
'plugin:@typescript-eslint/recommended-requiring-type-checking',
'plugin:svelte/recommended',
'plugin:svelte/prettier',
'prettier'
],
plugins: ['@typescript-eslint'],
ignorePatterns: ['*.cjs'],
overrides: [
{
files: ['*.svelte'],
parser: 'svelte-eslint-parser',
parserOptions: {
parser: '@typescript-eslint/parser'
}
}
],
parserOptions: {
sourceType: 'module',
ecmaVersion: 2020,
project: './tsconfig.json',
extraFileExtensions: ['.svelte']
},
env: {
browser: true,
es2017: true,
node: true
}
};
<form
method="POST"
action="?/test"
use:enhance={() => {
return ({ result, update }) => {
if (result.type === 'success') {
const x = result.data?.hello;
console.log({ x });
}
update();
};
}}
>
What did you expect to happen?
No errors as result.type
and result.data
are recognized by typescript.
What actually happened?
16:9 error Unsafe member access .type on an `any` value @typescript-eslint/no-unsafe-member-access
17:12 error Unsafe assignment of an `any` value @typescript-eslint/no-unsafe-assignment
17:16 error Unsafe member access .data on an `any` value @typescript-eslint/no-unsafe-member-access
18:20 error Unsafe assignment of an `any` value @typescript-eslint/no-unsafe-assignment
20:5 error Unsafe call of an `any` typed value @typescript-eslint/no-unsafe-call
Link to GitHub Repo with Minimal Reproducible Example
https://github.com/sidharthv96/sk-test
Additional comments
No response