JS: expanded suspicious-method-name-declaration test suite

This commit is contained in:
Napalys Klicius
2025-06-11 14:01:57 +02:00
parent 75caa182f5
commit 41f4236b86
2 changed files with 78 additions and 0 deletions

View File

@@ -50,3 +50,70 @@ declare class Quz {
var bla = new Foo();
var blab = new Baz();
interface X {
constructor: () => string; // Just a property, not a method.
}
type A = {
function(): number; // $ Alert
};
type B = {
constructor(): number; // $ Alert
new(): number;
};
class StaticMethods {
static function(): void {}
static new(): void {}
}
interface Overloaded {
function(x: string): string; // $Alert
function(x: number): number; // $Alert
function(x: any): any; // $Alert
}
abstract class AbstractFoo {
abstract new(): void; // $Alert
}
abstract class AbstractFooFunction {
abstract function(): number; // $Alert
}
abstract class AbstractFooConstructor {
constructor(){}
}
declare module "some-module" {
interface ModuleInterface {
function(): void; // $Alert
}
}
type Intersection = {
function(): number; // $Alert
} & {
other(): string;
};
type Union = {
new(): number;
} | {
valid(): string;
};
type Union2 = {
constructor(): number; // $Alert
} | {
valid(): string;
};
type Intersection2 = {
constructor(): number; // $Alert
} & {
other(): string;
};