Skip to content

Circular typedef references causes incorrect error #34809

Closed
@sandersn

Description

@sandersn
// @filename: test.js
const mod1 = require('./mod1')
/** @typedef {number} CompilerStatus */
/** @type {CompilerStatus[]} */
var compilerStatus;
mod1;
module.exports = class C {
}

// @filename: mod1.js
/** @type {import("./test")} */
var megaman;
module.exports = megaman

Expected: No error, or maybe a circular reference error somewhere.

Actual: Error on @typedef {number} CompilerStatus: "Duplicate identifier 'CompilerStatus'.".

Bonus: in test.js, if you export module.exports = {} you get a stack overflow from the language service. I couldn't get this from the compiler, but I didn't try too hard.

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptFix AvailableA PR has been opened for this issue

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions