cevek / ttypescript

Over TypeScript tool to use custom transformers in the tsconfig.json
1.53k stars 56 forks source link

ttsc --watch does not work with typescript 4.0 and later #121

Closed hediet closed 2 years ago

hediet commented 3 years ago

This is the error I get once I started ttsc --watch and changed a file:

File change detected. Starting incremental compilation...

C:\dev\hediet\vscode-debug-visualizer\demos\js\node_modules\typescript\lib\typescript.js:2479
            throw e;
            ^

Error: Debug Failure. False expression: File extension for signature expected to be dts
Verbose Debug Information: Found: .map for C:/dev/hediet/vscode-debug-visualizer/demos/js/dist/demo_doubly-linked-list.d.ts.map:: All output files: ["C:/dev/hediet/vscode-debug-visualizer/demos/js/dist/demo_doubly-linked-list.d.ts.map","C:/dev/hediet/vscode-debug-visualizer/demos/js/dist/demo_doubly-linked-list.d.ts"]
    at updateShapeSignature (C:\dev\hediet\vscode-debug-visualizer\demos\js\node_modules\typescript\lib\typescript.js:112516:30)
    at Object.getFilesAffectedBy (C:\dev\hediet\vscode-debug-visualizer\demos\js\node_modules\typescript\lib\typescript.js:112470:18)
    at getNextAffectedFile (C:\dev\hediet\vscode-debug-visualizer\demos\js\node_modules\typescript\lib\typescript.js:112943:51)
    at getSemanticDiagnosticsOfNextAffectedFile (C:\dev\hediet\vscode-debug-visualizer\demos\js\node_modules\typescript\lib\typescript.js:113567:32)
    at Object.getSemanticDiagnostics (C:\dev\hediet\vscode-debug-visualizer\demos\js\node_modules\typescript\lib\typescript.js:113612:20)
    at emitFilesAndReportErrors (C:\dev\hediet\vscode-debug-visualizer\demos\js\node_modules\typescript\lib\typescript.js:115375:57)
    at result.afterProgramCreate (C:\dev\hediet\vscode-debug-visualizer\demos\js\node_modules\typescript\lib\typescript.js:115563:13)
    at Object.watchCompilerHost.afterProgramCreate (C:\dev\hediet\vscode-debug-visualizer\demos\js\node_modules\typescript\lib\tsc.js:470:13)
    at synchronizeProgram (C:\dev\hediet\vscode-debug-visualizer\demos\js\node_modules\typescript\lib\typescript.js:115853:22)
    at updateProgram (C:\dev\hediet\vscode-debug-visualizer\demos\js\node_modules\typescript\lib\typescript.js:116059:21)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
PS C:\dev\hediet\vscode-debug-visualizer\demos\js> 
wc5858 commented 3 years ago

Typescript has released latest version 4.3.2, but ttypescript is incompatible with it. I temporarily locked typescript's version (~4.0.3).

nonara commented 3 years ago

Would either of you mind trying it with ts-patch?

If you have an issue, I'll look into it and possibly submit a PR for ttypescript as well.

hediet commented 3 years ago

Would either of you mind trying it with ts-patch?

Is there a way to use ts-patch without ts-patch modifying any external files (like ttypescript)? Could you setup a github action that publishes some ts-patched-typescript?

nonara commented 3 years ago

Is there a way to use ts-patch without ts-patch modifying any external files (like ttypescript)?

Not at the moment. I have a plan for a new library which creates a much better plugin architecture. It will do in-memory modification with disk caching. Unfortunately, I'm pretty swamped, so that's in the hopeful pile.

Technically tsp will be faster, which is part of the reason I went with direct modification route to begin with. If your concern is with yarn overwriting it, there is an easy way to mitigate that. You can see an example in the crosstype repository

patroza commented 3 years ago

Would either of you mind trying it with ts-patch?

If you have an issue, I'll look into it and possibly submit a PR for ttypescript as well.

works a dream so far, thanks so much!

hediet commented 3 years ago

works a dream so far, thanks so much!

I can verify that!

"postinstall": "ts-patch install", works nicely to ensure that contributors don't need to care about ts-patch. However, I guess ts-patch is not going to work with yarn berry.

patroza commented 3 years ago

However, I guess ts-patch is not going to work with yarn berry.

Should work just fine if you leverage postinstall-postinstall package. Oh, "yarn berry" is a thing, "berry" is not a person :)

nonara commented 3 years ago

Given the activity on this, the issues with ttypescript and its unmaintained status, and the current limitation with ts-patch, I think it's time to do the rewrite.

I've sketched out the design. Here are the highlights:

I've decided to keep the name for simplicity and visibility. So the rewrite will be housed in ts-patch v2.

You can follow https://github.com/nonara/ts-patch/discussions/40 for updates

BTW - I've not looked into yarn 2 much, but if anyone wants to chime in on how we can support it out the gate, please feel free to share!

nonara commented 3 years ago

Development is underway! Would appreciate anyone's feedback on the config options and strategies laid out: https://github.com/nonara/ts-patch/discussions/40#discussioncomment-972611

cevek commented 2 years ago

Actually

MicahZoltu commented 2 years ago

This bug still appears to exist, why was it closed?

I took a look at ts-patch but it has 34 transitive dependencies while ttypescript has 0, so I would strongly prefer to see ttypescript fixed rather than migrating to ts-patch.