Skip to content

Incorrect "Duplicate identifier" error in JS file when JSDoc @typedef followed by parenthetical expression #36179

Closed
@davidpcaldwell

Description

@davidpcaldwell

TypeScript Version: 3.7.4

Search terms
duplicate identifier typedef jsdoc

Code
duplicate-identifier-expression.js

//@ts-check
/** @typedef {object} NotADuplicateIdentifier */

(2 * 2)

Expected behavior:
Compiles without error

Actual behavior:

$ env PATH="${PATH}:../slime/local/jsh/lib/node/bin" ../slime/local/jsh/lib/node/bin/tsc duplicate-identifier-expression.js --allowJs --noemit
duplicate-identifier-expression.js:2:23 - error TS2300: Duplicate identifier 'NotADuplicateIdentifier'.

2 /** @typedef {object} NotADuplicateIdentifier */
                        ~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error.

Notes:

  • Did not see equivalent error for .ts file.
  • Did not see equivalent error when expression not enclosed in parentheses.

Playground Link:
Could not recreate there.

Related Issues:
None found.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScript

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions