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

Inaccurate error or buggy behavior for JSDoc @typedef tags #30155

Open
DanielRosenwasser opened this issue Feb 28, 2019 · 1 comment
Open

Inaccurate error or buggy behavior for JSDoc @typedef tags #30155

DanielRosenwasser opened this issue Feb 28, 2019 · 1 comment
Labels
Bug A bug in TypeScript Domain: JavaScript The issue relates to JavaScript specifically Domain: JSDoc Relates to JSDoc parsing and type generation
Milestone

Comments

@DanielRosenwasser
Copy link
Member

// @ts-check

/**
 * @typedef Foo
 * @member foo {() => string}
 */
JSDoc '@typedef' tag should either have a type annotation or be followed by '@property' or '@member' tags.ts(8021)

We need to figure out what this message should actually be or make it work.

P.S. I can never figure out how to declare a typedef on the first try.

@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript Domain: JSDoc Relates to JSDoc parsing and type generation labels Feb 28, 2019
@DanielRosenwasser DanielRosenwasser added this to the TypeScript 3.4.0 milestone Feb 28, 2019
@DanielRosenwasser DanielRosenwasser changed the title Inaccurate error or buggy behavior for @typedef tags Inaccurate error or buggy behavior for JSDoc @typedef tags Feb 28, 2019
@DanielRosenwasser DanielRosenwasser added the Domain: JavaScript The issue relates to JavaScript specifically label Feb 28, 2019
@danvk
Copy link
Contributor

danvk commented May 19, 2019

I ran into this error today and got thoroughly confused. In the end, the problem was that I was using a Closure-style @typedef, with a var at the end:

/**
 * @typedef {{
 *   x: number;
 *   y: number;
 * }}
 */
var Point2D;

whereas TypeScript wants the Point2D inside the jsdoc comment:

/**
 * @typedef {{
 *   x: number;
 *   y: number;
 * }} Point2D
 */

There was no explicit error for the first form, TypeScript just didn't know about the type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: JavaScript The issue relates to JavaScript specifically Domain: JSDoc Relates to JSDoc parsing and type generation
Projects
None yet
Development

No branches or pull requests

4 participants