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

Support @class in JSDoc #12681

Open
mjbvz opened this issue Dec 5, 2016 · 2 comments
Open

Support @class in JSDoc #12681

mjbvz opened this issue Dec 5, 2016 · 2 comments
Labels
Domain: JavaScript The issue relates to JavaScript specifically Domain: JSDoc Relates to JSDoc parsing and type generation Has Repro This issue has compiler-backed repros: https://aka.ms/ts-repros Help Wanted You can do this Suggestion An idea for TypeScript VS Code Tracked There is a VS Code equivalent to this issue
Milestone

Comments

@mjbvz
Copy link
Contributor

mjbvz commented Dec 5, 2016

From microsoft/vscode#15168

For the following JavaScript code:

/**
 * @class
 * 
 * @param {number} x
 */
function Foo(x) {
    this.x = x
}

/**
 * @param {Foo} foo
 */
const request = function(foo) {

}

The @class jsdoc annotation for Foo does not seem to be recognized, so the type of foo in request is any:

screen shot 2016-12-05 at 3 25 07 pm

Changing the code to use class fixes the issue (you don't actually need the @class in this case):

screen shot 2016-12-05 at 3 26 45 pm

@waderyan waderyan added the VS Code Tracked There is a VS Code equivalent to this issue label Dec 10, 2016
@mhegazy mhegazy added Domain: JSDoc Relates to JSDoc parsing and type generation Help Wanted You can do this labels Dec 15, 2016
@mhegazy mhegazy added this to the Community milestone Dec 15, 2016
@mhegazy mhegazy added the Suggestion An idea for TypeScript label Dec 15, 2016
@weswigham weswigham added Domain: JavaScript The issue relates to JavaScript specifically and removed Salsa labels Nov 29, 2018
@RyanCavanaugh RyanCavanaugh modified the milestones: Community, Backlog Mar 7, 2019
@rubiesonthesky
Copy link

Still can be repro'ed in playground. In VS Code, hover shows correct type.

// @noImplicitAny: false
// @noImplicitThis: false
/**
 * @class
 * 
 * @param {number} x
 */
function Foo(x) {
    this.x = x
}

/**
 * @param {Foo} foo
 */
const request = function(foo) {
//                       ^?
}

Workbench Repro

@typescript-bot typescript-bot added the Has Repro This issue has compiler-backed repros: https://aka.ms/ts-repros label Mar 10, 2024
@typescript-bot
Copy link
Collaborator

typescript-bot commented Mar 11, 2024

👋 Hi, I'm the Repro bot. I can help narrow down and track compiler bugs across releases! This comment reflects the current state of this repro running against the nightly TypeScript.


Comment by @rubiesonthesky

⚠️ Assertions:

  • (parameter) foo: any

Historical Information
Version Reproduction Outputs
5.0.2, 5.1.3, 5.2.2, 5.3.2, 5.4.2

⚠️ Assertions:

  • (parameter) foo: any

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Domain: JavaScript The issue relates to JavaScript specifically Domain: JSDoc Relates to JSDoc parsing and type generation Has Repro This issue has compiler-backed repros: https://aka.ms/ts-repros Help Wanted You can do this Suggestion An idea for TypeScript VS Code Tracked There is a VS Code equivalent to this issue
Projects
None yet
Development

No branches or pull requests

8 participants