Skip to content

fix(51374): ts(80004): Quick fix... > Annotate with type from JSDoc :: object types #51378

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

Merged
merged 3 commits into from
Nov 7, 2022

Conversation

a-tarasyuk
Copy link
Contributor

@a-tarasyuk a-tarasyuk commented Nov 1, 2022

Fixes #51374

@typescript-bot typescript-bot added the For Uncommitted Bug PR for untriaged, rejected, closed or missing bug label Nov 1, 2022
@DanielRosenwasser
Copy link
Member

What is the behavior for something like this?

////class C {
////    /**
////     * @private
////     * @param {number} foo
////     * @param {Object} [bar]
////     * @param {String} bar.a
////     * @param {Object} [baz]
////     * @param {number} baz.c
////     */
////    m(foo, bar, baz) { }
////}

@a-tarasyuk
Copy link
Contributor Author

@DanielRosenwasser The result looks like this

class C {
    /**
     * @private
     * @param {number} foo
     * @param {Object} [bar]
     * @param {String} bar.a
     * @param {Object} [baz]
     * @param {number} baz.c
     */
    m(foo: number, bar: { a: string; }, baz: { c: number; }) { }
}

@gabritto
Copy link
Member

gabritto commented Nov 4, 2022

For future reference, I also checked that this works for nested JSDoc param tags, like so:

class E {
    /**
     * @private
     * @param {Object} [bar]
     * @param {Object} bar.a
     * @param {String} [bar.a.b]
     */
    m(bar) { }
}

But not sure if it warrants adding such a test, seems unlikely we'd regress on that.

@a-tarasyuk
Copy link
Contributor Author

@gabritto Thanks for the feedback and +1 use case. I've added a test to cover it.

@gabritto gabritto merged commit fa4b49d into microsoft:main Nov 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
For Uncommitted Bug PR for untriaged, rejected, closed or missing bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ts(80004): Quick fix... > Annotate with type from JSDoc :: object types
4 participants