Skip to content

BlueGreenMagick/tsdown_typeof_undefined

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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).

About

Minimally reproducible issue with rolldown_dts_plugin with `typeof undefined` usage as type

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors