Skip to content

getJsDocTags does not return @type annotations #13498

@domoritz

Description

@domoritz

I am writing a typescript to JSON schema converter and use the typescript compiler to find out the types and comments of a typescript program. I am using getJsDocTags to get annotations and would like to read the @type annotation.

TypeScript Version: 2.1.1

Code

/** @TJStype integer */
const integer: number = 1;

and

/** @type integer */
const integer: number = 1;

For the symbol integer, I am calling symbol.getJsDocTags().

Expected behavior:

I'd expect to the type jsdoc annotation. In other words, I expect the call to return [{ name: 'type', text: 'integer' }].

I understand that integer is not a valid js type but this behavior is surprising nonetheless.

Actual behavior:

It is missing. I get am empty array [].

Metadata

Metadata

Assignees

No one assigned

    Labels

    Domain: APIRelates to the public API for TypeScriptSuggestionAn idea for TypeScript

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions