Skip to content

JSDoc Allow {} around typecasts/declarations to be optional #19987

@weswigham

Description

@weswigham

TypeScript Version: 2.7.0-dev.201xxxxx

Code

        this._cachedTypeClasses[typeName] = /** @type function(new:Object) */ (object);

Expected behavior:
object cast to function(new:Object)

Actual behavior:

front_end/Runtime.js(398,24): error TS1138: Parameter declaration expected.

(Parse error on function keyword)

We've seen this before (and crashed on it), but choose not to make it not an error because it seemed wrong; however a lot of code that validates under closure compiler (namely the chrome devtools) appears to be written like this.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptDomain: JSDocRelates to JSDoc parsing and type generationFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions