Skip to content

Check @param names in JSDoc method documentation #11378

Description

@friflo

JSDoc applied to methods tend to age. Typically method parameters are added / removed / changed but their documentation remain unchanged.

Typescript compiler should check the PARAM names and should write an error, if they are not found in the method signature. Maybe this check should be optional, by a compiler flag.

TypeScript Version: (2.0.3)

Code

class TestValidateJSDocParams {
    /** Calculate the sum of the given numbers
     * @param x     first summand
     * @param y     second summand
     * @param z     third summand
     */
    public sum (a: number, b: number) : number {
        return a + b;
    }
}

Expected behavior:
Should log an tsc compiler error for unknown methods parameters: x, y, z

Actual behavior:
Compiles without an error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    CommittedThe team has roadmapped this issueDomain: JSDocRelates to JSDoc parsing and type generationEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Help WantedYou can do thisSuggestionAn idea for TypeScriptVS Code TrackedThere is a VS Code equivalent to this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions