Skip to content

[typedef] broken for constructor argument with access modificator and default value #921

@mrmlnc

Description

@mrmlnc

Related issues

Repro

{
    "parser": "@typescript-eslint/parser",
    "plugins": [
        "@typescript-eslint"
    ],
    "rules": {
        "@typescript-eslint/typedef": [
            "error",
            {
                "parameter": true
            }
        ]
    }
}
type Options = {
    force?: boolean;
}

class Something {
    // Works fine without `= {}`
    constructor(private readonly _options: Options = {}) {
        // something
    }
}

Expected Result

All fine. The output has no errors.

Actual Result

…\typescript-eslint-repro\src\index.ts
  6:17  error  expected a type annotation  @typescript-eslint/typedef

✖ 1 problem (1 error, 0 warnings)

Additional Info

The --debug argument could tell me nothing of interest.

Versions

package version
@typescript-eslint/eslint-plugin 2.0.0
@typescript-eslint/parser 2.0.0
TypeScript 3.5.3
ESLint 6.2.2
node 12.8.0
npm 6.10.2

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinghas prthere is a PR raised to close thispackage: eslint-pluginIssues related to @typescript-eslint/eslint-plugin

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions