79625984

Date: 2025-05-16 22:08:40
Score: 3
Natty:
Report link

The recursion can be defined with @typedef tag.

/** @type {<T>(v: T)=>T} */
const h = (v) => v;

/** @typedef {{bar: number, foo: recursive}} recursive */

const a = h(
    /** @returns {recursive} */
    () => {
        return {
            bar: 2,
            foo: a()
        };
    }
);

https://www.typescriptlang.org/play/?moduleResolution=99&target=99&jsx=0&module=100&ts=5.4.5&filetype=js#code/PQKhAIAEBcE8AcCm4DeAeAKgPgBQDcAucDASgF4sMBfcEYAKAGMB7AOwGdpwALcM8fCT5ZweANz16oCDASIAJogBmqFACMAhgCcirAK4BbNYi0AacEubMiWxIz1b2ASzyIqNW-ccvkdSSw4uDT4eHHpwCPBpKFtoBw5UTwdnVxo-SIEhClRwjMjY+Jy84vBNHXAAJlNcksjLa3ANHBIavKoJDKp6Egl6JpIAOnqhqwGyiSA

Reasons:
  • Probably link only (1):
  • Low length (0.5):
  • Has code block (-0.5):
  • User mentioned (1): @typedef
  • Low reputation (1):
Posted by: KaaBEL