nonara / ts-patch

Augment the TypeScript compiler to support extended functionality
MIT License
760 stars 26 forks source link

Bug when typescript version is less than v5.3 #140

Closed samchon closed 11 months ago

samchon commented 11 months ago

https://github.com/samchon/typia/actions/runs/7110594963/job/19357301610#logs

If TypeScript version is less than 5.3, and ts-patch is the latest (3.1.0), such bug being occured when running tsc command.

@nonara I think it would better to assign the 0 value directly instead of using the enumeration accessing, or add checking condition whether the tsShim.JSDocParsingMode property exists or not.

PS @typia/benchmark> npm run build

> @typia/benchmark@0.1.0 build
> rimraf bin && tsc

/home/runner/work/typia/typia/packages/benchmark/node_modules/typescript/lib/tsc.js:568
                host.jsDocParsingMode = tsp.tsShim.JSDocParsingMode.ParseAll;
                                                                    ^

TypeError: Cannot read properties of undefined (reading 'ParseAll')
    at Object.createProgram (/home/runner/work/typia/typia/packages/benchmark/node_modules/typescript/lib/tsc.js:568:69)
    at createProgram (/home/runner/work/typia/typia/packages/benchmark/node_modules/typescript/lib/tsc.js:118899:41)
    at performCompilation (/home/runner/work/typia/typia/packages/benchmark/node_modules/typescript/lib/tsc.js:175079:21)
    at executeCommandLineWorker (/home/runner/work/typia/typia/packages/benchmark/node_modules/typescript/lib/tsc.js:174888:9)
    at executeCommandLine (/home/runner/work/typia/typia/packages/benchmark/node_modules/typescript/lib/tsc.js:174971:14)
    at Object.tsp.execTsc (/home/runner/work/typia/typia/packages/benchmark/node_modules/typescript/lib/tsc.js:175493:23)
    at Object.<anonymous> (/home/runner/work/typia/typia/packages/benchmark/node_modules/typescript/lib/tsc.js:175497:5)
    at Module._compile (node:internal/modules/cjs/loader:1198:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1252:10)
    at Module.load (node:internal/modules/cjs/loader:1076:32)
Error: Command failed: npm run build
    at checkExecSyncError (node:child_process:861:11)
    at Object.execSync (node:child_process:932:15)
    at /home/runner/work/typia/typia/deploy/index.ts:12:8
    at Array.forEach (<anonymous>)
    at /home/runner/work/typia/typia/deploy/index.ts:67:16
    at main (/home/runner/work/typia/typia/deploy/index.ts:95:29)
    at Object.<anonymous> (/home/runner/work/typia/typia/deploy/index.ts:105:1)
    at Module._compile (node:internal/modules/cjs/loader:1198:14)
    at Module.m._compile (/home/runner/work/typia/typia/node_modules/ts-node/src/index.ts:1618:23) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 2214,
  stdout: null,
  stderr: null
}
Error: Process completed with exit code 1.