-
Notifications
You must be signed in to change notification settings - Fork 39
False Positive error when extending a deprecated method #25
Comments
I'm facing a similar issue where a function has multiple signatures, one of which is deprecated and even if I use the new calling convention I get a warning. // From "fast-check" package
/**
* @deprecated
*/
declare function lorem(maxWordsCount: number, sentencesMode: boolean): Arbitrary<string>;
declare function lorem(constraints: LoremConstraints): Arbitrary<string>; import * as fc from "fast-check"
fc.lorem({ maxCount: 5 }) // <- warning issued here. |
@wereHamster I cannot reproduce this. For me, everything works fine:
Are you sure the lint error is reported by this package? I ran into a very similar issue using |
We just released an updated with latest deps in v1.3.1 maybe you can try it out and see if this is still an issue? |
@Delagen unfortunately this is still an issue with the latest version. |
@json-derulo tried to fix this in Delagen#1, but I reverted it by his opinion about false positives Delagen#1 (comment). May be someone try to fix this? PR are welcome |
Yes I tried to fix it, but it turned out to be way more complex than expected. I did not succeed to fix this. What I observed is that the unit tests don't cover every case. I've updated them while trying to fix the issue, opened #42 to add them. |
I've been able to narrow down the issue. With TypeScript 4.1 it works, since TypeScript 4.2 the described case is broken. Maybe due to their new feature |
Any updates on this? Facing same exact issue. Angular 12 |
Similar issue with
Getting the following error message when using MockInstance.scope():
|
Here is a test-case which is currently failing: getValidTestCase(`
/** @deprecated */ function Test(param: number): void;
declare namespace Test {
function any(): void;
}
Test.any();
`), |
I've encountered the same issue while updating faker. In my case, the problem is that faker is using TypeScript's function overload to type the signature of some methods. Some overloads are valid, while others are deprecated. Something like this: foo(value: number): void;
/**
* @deprecated use numeric inputs instead
*/
foo(value: string): void; In this case, I believe ESLint can't correctly handle this use case. Imagine this code: foo(value); Is In cases like this, where there's a function overload, and only some of the declarations are deprecated, I suggest this plugin ignores the code altogether. For an example of a real-world failing code see https://github.com/faker-js/faker/blob/293f12741acb188fd8c7d9d6b3dc2dd9b52d4214/src/modules/date/index.ts#L70-L190 |
@Gpx it seems like your issue (overloaded functions/methods) is different from this one (extended class methods) so I would suggest you to go ahead and create a separate issue for it. |
In the following scenario, when calling
method()
on an instance of theNew
class, the plugin should not report an error, but it does:The text was updated successfully, but these errors were encountered: