Skip to content

Support JSDoc parameters with properties using @param #16056

Closed
@BrunnerLivio

Description

@BrunnerLivio

This is a suggestion/feature request for the @ts-check feature.

When using // @ts-check in a JavaScript file, TypeScript-check should be able to identify object properties types using JSDoc.

For example:

// @ts-check
/*
 * @param {Object} bar The bar object
 * @param {Number} bar.id The id of the bar object
 * @param {Object} bar.foo The foo object
 * @param {Number} bar.foo.id The id of the foo object
 */
export function Foo(bar) {
  console.log(bar.id); // TypeScript: "Holy moly it is a number"
  console.log(bar.foo.id); // TypeScript: "OMG another one"
}

Also described on JSDoc.

I hope you get the idea :)
Keep up the good work!

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions