Skip to content

JSDoc optionality should apply from param tags even without a type #868

Closed
@sandersn

Description

@sandersn
Member
/**
 * @param [a] - you don't have to provide a
 */
function f(a) {
}

Expected signature: f(a?: any): void
Actual signature: f(a: any): void

Note that if we want to retain the UntypedSignatureInJSFile rules, this feature is not needed. However, omitting any untyped argument in JS doesn't make sense for today's uses of JS, and whatever support we have in Corsa should be removed.

Activity

self-assigned this
on May 14, 2025
sandersn

sandersn commented on May 16, 2025

@sandersn
MemberAuthor

Never mind, I misread the code. When I tested it, optionality applies any time the parameter's type is nil, not the tag's. Which is always the case in correct JS code; and in incorrect code where somebody has put in a type annotation by mistake, I'd expect the semantics to follow TS, plus an error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @sandersn

      Issue actions

        JSDoc optionality should apply from param tags even without a type · Issue #868 · microsoft/typescript-go