language-tools icon indicating copy to clipboard operation
language-tools copied to clipboard

Unable to run vue-tsc after running ts-patch install -s

Open Thomasan1999 opened this issue 1 year ago • 9 comments

Vue - Official extension or vue-tsc version

2.1.4

VSCode version

Vue version

TypeScript version

5.5.4

System Info

System:
  OS: Windows 11 10.0.22631
  CPU: (16) x64 11th Gen Intel(R) Core(TM) i7-11800H @ 2.30GHz
  Memory: 10.62 GB / 31.73 GB
Binaries:
  Node: 20.5.1 - C:\Program Files\nodejs\node.EXE
  npm: 9.8.0 - C:\Program Files\nodejs\npm.CMD
Browsers:
  Edge: Chromium (127.0.2651.74)
  Internet Explorer: 11.0.22621.3527

package.json dependencies

{
  "type": "module",
  "scripts": {
    "prepare": "ts-patch install -s",
    "vue-tsc": "vue-tsc"
  },
  "devDependencies": {
    "ts-patch": "3.2.1",
    "vue-tsc": "2.1.4"
  }
}

Steps to reproduce

  1. Copy package.json to some directory.
  2. Run npm i.
  3. Run npm run vue-tsc.

What is expected?

It works.

What is actually happening?

I get the following error:

.\node_modules\vue-tsc\index.js:56
            throw err;
            ^

TypeError: Cannot read properties of undefined (reading 'useCaseSensitiveFileNames')
    at Object.proxyCreateProgram (.\node_modules\@volar\typescript\lib\node\proxyCreateProgram.js:33:68)
    at .\node_modules\typescript\lib\tsc.js:552:153
    at .\node_modules\typescript\lib\tsc.js:606:7
    at Object.<anonymous> (.\node_modules\typescript\lib\tsc.js:627:3)
    at Module._compile (node:internal/modules/cjs/loader:1233:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
    at Module.load (node:internal/modules/cjs/loader:1091:32)
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at Module.require (node:internal/modules/cjs/loader:1115:19)
    at require (node:internal/modules/helpers:130:18)

Node.js v20.5.1

Process finished with exit code 1

Link to minimal reproduction

No response

Any additional comments?

I wanted to write a TS plugin using ts-patch which would exclude some declaration files from being emitted when running vue-tsc. After I installed ts-patch, vue-tsc stopped working and I got this error.

Thomasan1999 avatar Sep 01 '24 20:09 Thomasan1999

I have the same issue, were you able to find a solution?

Demon000 avatar Sep 14 '24 16:09 Demon000

I found another solution for the underlying issue I was using ts-patch to try to resolve. I did not look into this further ever since.

Thomasan1999 avatar Sep 15 '24 09:09 Thomasan1999

I'm using it for typia, and I can't seem to find an alternative.

Demon000 avatar Sep 15 '24 10:09 Demon000

For people who are bundling their code, unplugin-typia is a more convenient alternative to ts-patch that doesn't interfere with other tools using tsc.

zareith avatar Oct 20 '24 13:10 zareith

For people who are bundling their code, unplugin-typia is a more convenient alternative to ts-patch that doesn't interfere with other tools using tsc.

@zareith You still need to install typia which requires ts-patch ..

sgpinkus avatar Dec 20 '24 01:12 sgpinkus

You still need to install typia which requires ts-patch ..

@sgpinkus That doesn't matter if you don't configure it to patch the ts compiler dependency in your project.

If you have configured ts patch in your project in past you will need to remove and do a clean install of dependencies. It works fine after that.

zareith avatar Dec 20 '24 04:12 zareith

In the setup docs for typia there is the step npx typia setup. This installs ts-patch and applies the patch. AFAIK that step is not optional.

sgpinkus avatar Dec 20 '24 05:12 sgpinkus

@sgpinkus It is optional.

Just run npx typia setup command if you’re using tsc. The setup wizard will do everything.

Note the part about "if using tsc". If you use another bundler and typia integration for said bundler, you don't need the typia setup step.

zareith avatar Dec 20 '24 07:12 zareith

Erm, no I don't think your correct here.

sgpinkus avatar Dec 20 '24 08:12 sgpinkus

Cannot reproduce anymore with v3. Please open a new issue with a minimal reproduction if it still happens.

KazariEX avatar Jul 07 '25 14:07 KazariEX