timocov / dts-bundle-generator

A tool to generate a single bundle of dts with types tree-shaking
MIT License
762 stars 40 forks source link

[9.1.0+] Handling globalThis fails #282

Closed Shin-Ogata closed 10 months ago

Shin-Ogata commented 10 months ago

Bug report Thank you for the great job. Since v9.1.0, an internal error seems to occur when processing globalThis. It is also reproduced in v9.2.0.

Input code

export declare function getGlobal(): typeof globalThis;

Expected output N/A

Actual output N/A

Error Report

> dts-bundle-generator --config ./config.json --verbose

Verbose log enabled
Trying to load config from ./config.json file...
Total entries count=1
Compiling input files...
Using config: tsconfig.json
Skipping compiling the project to generate d.ts because all files in it are d.ts already
dts cache:

dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/types/index.d.ts (types/index.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/types/global.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/types/global.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2022.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2022.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2021.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2021.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2020.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2020.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2019.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2019.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2018.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2018.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2017.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2017.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2016.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2016.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2015.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2015.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es5.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es5.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.decorators.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.decorators.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.decorators.legacy.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.decorators.legacy.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2015.core.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2015.core.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2015.collection.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2015.collection.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2015.iterable.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2015.iterable.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2015.symbol.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2015.symbol.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2015.generator.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2015.generator.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2015.promise.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2015.promise.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2015.proxy.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2015.proxy.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2015.reflect.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2015.reflect.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2016.array.include.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2016.array.include.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2017.object.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2017.object.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2017.sharedmemory.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2017.string.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2017.string.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2017.intl.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2017.intl.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2017.typedarrays.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2017.date.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2017.date.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2018.asynciterable.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2018.asyncgenerator.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2018.promise.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2018.promise.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2018.regexp.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2018.regexp.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2018.intl.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2018.intl.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2019.array.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2019.array.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2019.object.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2019.object.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2019.string.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2019.string.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2019.symbol.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2019.symbol.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2019.intl.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2019.intl.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2020.bigint.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2020.bigint.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2020.intl.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2020.intl.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2020.date.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2020.date.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2020.number.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2020.number.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2020.promise.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2020.promise.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2020.sharedmemory.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2020.string.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2020.string.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2020.symbol.wellknown.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2021.promise.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2021.promise.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2021.string.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2021.string.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2021.weakref.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2021.weakref.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2021.intl.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2021.intl.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2022.array.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2022.array.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2022.error.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2022.error.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2022.intl.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2022.intl.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2022.object.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2022.object.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2022.sharedmemory.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2022.string.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2022.string.d.ts)
dts cache mismatch: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2022.regexp.d.ts (C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/node_modules/typescript/lib/lib.es2022.regexp.d.ts)
Input source files:
  C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/types/global.d.ts
  types/index.d.ts
Processing types/index.d.ts

======= Preparing file: C:/Users/shin/Projects/GitHub/PR/dts-bundle-generator-globalThis/types/global.d.ts =======

======= Preparing file: types/index.d.ts =======

Error: Cannot read properties of undefined (reading 'kind')

How to reproduce the issue

Environment

OS: Windows 10
NodeJS: v20.9.0
npm: v10.1.0
typescript: v5.3.3
dts-bundle-generator: v9.2.0 (v9.1.0)
timocov commented 10 months ago

Thanks for reporting! Looks like these symbols exist at the compiler level only so they don't have associated AST nodes that the tool needed. Fixed in 6a132dde62ec6261a4a68bfb26efd85dc0bae699 and released in v9.2.1.