Skip to content

JSDoc function annotations not working for chain assignment #18085

@mjbvz

Description

@mjbvz

From microsoft/vscode#33221

TypeScript Version: 2.5.1

Code
For the JS code:

/**
 * @return {Number}
 */
const f = exports.z = () => ({})

const x = f();

Expected behavior:
Type of x is number

Actual behavior:
Type of x is { [x: string]: any}

If you get rid of the chained assignment and instead writeconst f= () => ({}), the types work as expected

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptDomain: JavaScriptThe issue relates to JavaScript specificallyVS Code TrackedThere is a VS Code equivalent to this issue

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions