-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Closed
Labels
enhancement: new plugin ruleNew rule request for eslint-pluginNew rule request for eslint-pluginhas prthere is a PR raised to close thisthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin
Description
Recently I found out that the shorthand method syntax is looser type-wise than the non-shorthand syntax:
interface MyInterface {
fn1(num: number | undefined): void;
fn2: (num: number | undefined) => void;
}
const badObject: MyInterface = {
fn1(num: number) {}, // no error??
fn2(num: number) {} // error
}
const shouldBeBadObject: MyInterface = {
fn1(num: number) {}, // no error??
fn2(num: number | undefined) {}
}
const goodObject: MyInterface = {
fn1(num: number | undefined) {},
fn2(num: number | undefined) {}
}
Would it make sense to add a new @typescript-eslint/eslint-plugin
rule to enforce the non-/shorthand syntax?
amanmahajan7, sk-, vkrol and ifiokjr
Metadata
Metadata
Assignees
Labels
enhancement: new plugin ruleNew rule request for eslint-pluginNew rule request for eslint-pluginhas prthere is a PR raised to close thisthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-pluginIssues related to @typescript-eslint/eslint-plugin