Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork2.8k
Open
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 havesearched for related issues and found none that matched my issue.
- I haveread the FAQ and my problem is not listed.
Playground Link
Repro Code
declareconsttest1:(t:number)=>void;declareconsttest2:<Textendsnumber>(t:T)=>void;// fails correctlytest1(1asany);// should failtest2(1asany);
ESLint Config
module.exports={parser:"@typescript-eslint/parser",rules:{"@typescript-eslint/no-unsafe-argument":"error"},};
tsconfig
{"compilerOptions": {"strictNullChecks":true }}Expected Result
I expect all use-cases to be consistent and report this as an error.
Actual Result
The use-cases with a type constraint doesn't report this as an error.
Additional Info
This seems similar to#10314, and it looks like the fix should be similar.
I'll add that I see similar inconsistencies onno-unsafe-assignment andno-unsafe-return (false positives, in which the rule reports unnecessarily):
// no-unsafe-returndeclareconsttest1:(callback:()=>unknown)=>void;declareconsttest2:<T>(callback:()=>T)=>void;declareconsttest3:<Textendsunknown>(callback:()=>T)=>void;// passes correctlytest1(()=>1asany);// should passtest2(()=>1asany);// should passtest3(()=>1asany);// no-unsafe-assignmentdeclareconsttest4:(t:{t:unknown})=>void;declareconsttest5:<Textendsunknown>(t:{t:T})=>void;// pass correctlytest4({t:1asany});// should passtest5({t:1asany});
I'll be happy also to report them (separately or as part of this issue) if this makes sense.