Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
dragomirtitian opened this issue Feb 18, 2022 · 0 comments Β· Fixed by #47959
Closed
Assignees
Labels
Bug A bug in TypeScript checkJs Relates to checking JavaScript using TypeScript Domain: JavaScript The issue relates to JavaScript specifically Domain: JSDoc Relates to JSDoc parsing and type generation Domain: Quick Fixes Editor-provided fixes, often called code actions.

Comments

@dragomirtitian
Copy link
Contributor

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.

@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript checkJs Relates to checking JavaScript using TypeScript Domain: JavaScript The issue relates to JavaScript specifically Domain: JSDoc Relates to JSDoc parsing and type generation Domain: Quick Fixes Editor-provided fixes, often called code actions. labels Feb 18, 2022
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 4.6.2 milestone Feb 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript checkJs Relates to checking JavaScript using TypeScript Domain: JavaScript The issue relates to JavaScript specifically Domain: JSDoc Relates to JSDoc parsing and type generation Domain: Quick Fixes Editor-provided fixes, often called code actions.
Projects
None yet
3 participants