Closed
Description
TypeScript Version: 4.0.0-dev.20200701
Search Terms: Jsdoc type alias circularly references itself
I'm trying to describe json type in .js
file using jsdoc.
// Type alias 'JsonArray' circularly references itself.
/** @typedef {ReadonlyArray<Json>} JsonArray */
/** @typedef {{ readonly [key: string]: Json }} JsonRecord */
// Type alias 'Json' circularly references itself.
/** @typedef {boolean | number | string | null | JsonRecord | JsonArray | readonly []} Json */
It shows me some errors that JsonArray and Json types circularly reference to itself.
Tried the same in .ts
file. There got no errors.
type JsonArray = ReadonlyArray<Json>
type JsonRecord = { readonly [key: string]: Json }
// OK
type Json = boolean | number | string | null | JsonRecord | JsonArray | readonly []
Expected behaviour: Json types in .js
and .ts
files should work identical.