Skip to content

Unexpected error in param jsdoc tags for methods containing arguments - 4.6 RC regressionΒ #47949

@dragomirtitian

Description

@dragomirtitian

Bug Report

πŸ”Ž Search Terms

jsdoc

πŸ•— Version & Regression Information

  • This changed between versions 4.6.0-beta and 4.6.1-rc

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

class Bug {
  
    /**
     * @param {some-module.Request} request
     */
    sendRequest(request: unknown): void {
        arguments; // Remove this, error goes away
    }

}

πŸ™ Actual behavior

An error occurs in the type of the @param jsdoc tag: Cannot find name 'some'.

πŸ™‚ Expected behavior

No error occurs on the @param jsdoc tag

Notes

This only happens if arguments is referenced in the body of the method.

This behavior was introduced in #47257 (ping @a-tarasyuk )

The issue seems to be that if arguments is referenced then getTypeFromTypeNode(lastJSDocParam.typeExpression.type) (Line) is invoked to see if the the last parameter is an array type. The problem is getTypeFromTypeNode will add the diagnostics about being unable to find some even though in this context we probably don't want to add it.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationDomain: JavaScriptThe issue relates to JavaScript specificallyDomain: Quick FixesEditor-provided fixes, often called code actions.checkJsRelates to checking JavaScript using TypeScript

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions