Microsoft/TypeScript

Circular reference error happens in jsdoc but not in typescript.

Open

#46,369 建立於 2021年10月14日

在 GitHub 查看
 (6 留言) (9 反應) (0 負責人)TypeScript (6,726 fork)batch import
BugDomain: JSDocEffort: DifficultHelp Wanted

倉庫指標

Star
 (48,455 star)
PR 合併指標
 (平均合併 6天 17小時) (30 天內合併 9 個 PR)

描述

Bug Report

🔎 Search Terms

circularly references itself jsdoc ts2456

🕗 Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about circular

⏯ Playground Link

Playground link (js) Playground link (ts)

💻 Code

Foo.js

/** @typedef {Object.<string, Foo>} Foo */

Foo.ts

type Foo = {
    [x: string]: Foo;
};

🙁 Actual behavior

Type alias 'Foo' circularly references itself. ts(2456) happens in Foo.js. The TypeScript equivalent works fine.

🙂 Expected behavior

Both Foo.ts and Foo.js work without errors.

Related issues

I found some related issues but they are either closed or use a different example. #39372 - Closed (fixed) #45641 - Seems very similar but uses Array<> and typescript rather than jsdoc. I'm not sure if the root cause is the same so this might be a duplicate.

貢獻者指南