jaredpalmer / tsdx

Zero-config CLI for TypeScript package development
https://tsdx.io
MIT License
11.2k stars 505 forks source link

"Cannot find name 'WindowPostMessageOptions'" -- upgrade TS version #1094

Closed FDiskas closed 2 years ago

FDiskas commented 2 years ago

Current Behavior

image

Expected behavior

If I remove DOM from lib, I get the same error as it is shown in error when building.

Suggested solution(s)

Respect project tsconfig.json file. I know some values needs to be overwritten e.x. target but other values should be taken from tsconfig.

Additional context

tsconfig.json

{
  "compilerOptions": {
    "module": "esnext",
    "lib": ["dom", "esnext"],
    "importHelpers": true,
    "declaration": true,
    "sourceMap": true,
    "rootDir": "./src",
    "strict": false,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": true,
    "noUnusedLocals": true,
    "noUnusedParameters": true,
    "moduleResolution": "node",
    "esModuleInterop": true,
    "skipLibCheck": true,
     "forceConsistentCasingInFileNames": true,
    "noEmit": true
  },
  "include": ["src", "types"],
  "exclude": ["node_modules", "dist"]
}

Your environment

  System:
    OS: Linux 5.11 Freedesktop.org 21.08.4 (Flatpak runtime) 21.08.4 (Flatpak runtime)
    CPU: (8) x64 Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
    Memory: 11.53 GB / 31.13 GB
    Container: Yes
    Shell: 5.1.8 - /bin/sh
  Binaries:
    Node: 14.17.6 - ~/.nvm/versions/node/v14.17.6/bin/node
    Yarn: 1.22.11 - ~/.nvm/versions/node/v14.17.6/bin/yarn
    npm: 6.14.15 - ~/.nvm/versions/node/v14.17.6/bin/npm
  npmPackages:
    tsdx: ^0.14.1 => 0.14.1 
    typescript: ^4.4.4 => 4.4.4 
FDiskas commented 2 years ago

I tried to create tsdx configuration file but it is not possible to overwrite the plugin.

agilgur5 commented 2 years ago

Respect project tsconfig.json file. I know some values needs to be overwritten e.x. target but other values should be taken from tsconfig.

It does respect tsconfig.json -- that's why it's included in the templates -- and in fact only overrides target

The problem is not that it's not respecting DOM from lib, it's that DOM is outdated. TSDX is still on TS v3 (and has not been maintained in some time), and v3 DOM does not have WindowPostMessageOptions.

As such this is a duplicate of #926 . See that issue for workarounds such as Yarn resolutions