rolldown-plugin-dts(v0.21.5) does not compile typeof undefined usage as a type correctly.
export function typeof_undefined(): typeof undefined {
return undefined;
}This is transformed into below .d.ts code which the typescript library(v5.9.3) fails to parse.
declare function typeof_undefined(): typeof void 0;Various error may appear depending on context:
TS1144: '{' or ';' expected.
TS1005: ';' expected.
Apparantly, typeof undefined is a valid type in typescript because undefined is a global object. (ECMA spec)
You can test this out by opening a browser and running window.undefined: you'll get the value undefined
Found this error when using tsdown to build the library acorn-typescript (problematic code).