Skip to content

Bracketed @param name doesn't add null | undefined in strict mode #22412

@sandersn

Description

@sandersn

Code

// @noEmit: true
// @allowJs: true
// @checkJs: true
// @strict: true
// @Filename: a.js

/** @param {number} [p] */
function f(p) {
    p = undefined
    p = null
}

Expected behavior:

The type of p should be number | null | undefined, and should be optional in the signature of f.

Actual behavior:

p is optional but doesn't include null | undefined in its type.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFixedA PR has been merged for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions