-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed as not planned
Closed as not planned
Copy link
Labels
fix: user errorissue was fixed by correcting the configuration / correcting the codeissue was fixed by correcting the configuration / correcting the codelocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-pluginplease fill out the templatewe have the processes for good reasons 😔we have the processes for good reasons 😔
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.
- I have searched for related issues and found none that matched my issue.
- I have read the FAQ and my problem is not listed.
Playground Link
https://github.com/hasakilol/react-vite/blob/master/src/Test.tsx
Repro Code
Please focus on `Test.tsx` and ignore other source files.
Run `npx eslint --fix src/Test.tsx` in project root dir.
ESLint Config
export default tseslint.config(
{
name: 'plugins',
plugins: {
['@typescript-eslint']: tseslint.plugin,
},
},
{
languageOptions: {
globals: {
...globals.node,
...globals.es2015,
},
parserOptions: {
allowAutomaticSingleRunInference: true,
project: ['tsconfig.json'],
tsconfigRootDir: '.',
}
},
},
{
name: 'src',
files: ['src/**/*.ts', 'src/**/*.tsx', 'src/**/*.mts', 'src/**/*.cts'],
extends: tseslint.configs.recommendedTypeChecked,
languageOptions: {
parser,
parserOptions: {
ecmaFeatures: {
jsx: true
},
sourceType: 'module',
},
globals: {
...globals.browser,
...globals.mocha,
...globals.jest,
...globals.jasmine,
},
},
rules: {
'@typescript-eslint/consistent-type-imports': 'error',
}
},
);
tsconfig
No response
Expected Result
import type { Null } from './utils/common.ts'; // Pay attention here
import { Undefined} from './utils/common.ts';
import React from 'react';
import { Button } from "antd";
interface TestProps {
onClick: (
item?: { a: string; } | typeof Null | typeof Undefined,
selected?: boolean,
) => void;
}
const Test: React.FC<TestProps> = (props) => {
const {
onClick,
} = props;
return <Button onClick={() => onClick(Undefined, true)}></Button>
};
export default Test;
Actual Result
import type { Null } from './utils/common.ts';
import { Undefined} from './utils/common.ts';
import React from 'react';
import { Button } from "antd";
interface TestProps {
onClick: (
item?: { a: string; } | typeof Null , // Unexpected change here !!!!!!
selected?: boolean,
) => void;
}
const Test: React.FC<TestProps> = (props) => {
const {
onClick,
} = props;
return <Button onClick={() => onClick(Undefined, true)}></Button>
};
export default Test;
Additional Info
"@typescript-eslint/eslint-plugin": "^8.0.0-alpha.14",
"@typescript-eslint/parser": "^8.0.0-alpha.14",
"@typescript-eslint/scope-manager": "^8.0.0-alpha.14",
"@typescript-eslint/type-utils": "^8.0.0-alpha.14",
"@typescript-eslint/types": "^8.0.0-alpha.14",
"@typescript-eslint/typescript-estree": "^8.0.0-alpha.14",
"@typescript-eslint/utils": "^8.0.0-alpha.14",
"@typescript-eslint/visitor-keys": "^8.0.0-alpha.14",
"typescript-eslint": "^8.0.0-alpha.14",
"eslint": "^9.3.0",
Metadata
Metadata
Assignees
Labels
fix: user errorissue was fixed by correcting the configuration / correcting the codeissue was fixed by correcting the configuration / correcting the codelocked due to agePlease open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.Please open a new issue if you'd like to say more. See https://typescript-eslint.io/contributing.package: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-pluginplease fill out the templatewe have the processes for good reasons 😔we have the processes for good reasons 😔