TypeStrong / tsify

Browserify plugin for compiling TypeScript
344 stars 75 forks source link

Can't parse ES2020 or higher #280

Closed falsandtru closed 2 years ago

falsandtru commented 2 years ago

On https://github.com/falsandtru/spica, tsify throws the following strange errors with ES2021 or higher (However, I've seen the same error on another repo with ES2020).

$ node_modules/.bin/browserify src/random.ts -p [ tsify --target ES2021 ]
SyntaxError: Unexpected token (20:10) while parsing ...\src\random.ts while parsing file: ...\src\random.ts
    at DestroyableTransform.end [as _flush] (...\node_modules\insert-module-globals\index.js:114:21)
    at DestroyableTransform.prefinish (...\node_modules\readable-stream\lib\_stream_transform.js:138:10)
    at DestroyableTransform.emit (node:events:394:28)
    at prefinish (...\node_modules\readable-stream\lib\_stream_writable.js:619:14)
    at finishMaybe (...\node_modules\readable-stream\lib\_stream_writable.js:627:5)
    at endWritable (...\node_modules\readable-stream\lib\_stream_writable.js:638:3)
    at DestroyableTransform.Writable.end (...\node_modules\readable-stream\lib\_stream_writable.js:594:41)
    at DestroyableTransform.onend (...\node_modules\readable-stream\lib\_stream_readable.js:577:10)
    at Object.onceWrapper (node:events:513:28)
    at DestroyableTransform.emit (node:events:406:35)
$ node_modules/.bin/browserify src/random.ts -p [ tsify --target ESNEXT ]
TypeScript error: .../src/cache.ts(248,41): Error TS2729: Property 'capacity' is used before its initialization.

@cartant Could you fix this?

falsandtru commented 2 years ago

Not seems a bug of tsify.