-
-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Not working with TypeScript v5 (author's note) #93
Comments
Thank you for all the effort you put on this. I just want to raise a point that waiting until the end of April can be too much of a delay for some projects (mine in particular). Given the fact that the beta was released 2 months ago the current situation isn't promising and it may push users to seek for other solutions (including myself). There is any way we can speed up the migration? 🙏 |
A few points...
Notably, I also had three people who claimed to be willing to help lined up months ago, and all backed out. I say this with personal respect, but also with the due response to such a message - if you'd like to take your "business" elsewhere, you're more than welcome to do so. However, at present, this is a problem that is not yet solved and is, as I've said, non-trivial. Lastly, I also think this is important to point out - If this was an issue that prevented current libraries from working, that is one thing, but rewriting everything to support a new major version is another. The latter is nice to have early, but the worst case scenario is you wait an additional month to use the latest features. It's not ideal, but it may happen from time to time. Demanding a maintainer work more quickly for free so that you can use the newest features is precisely the sort of thing that I've seen embitter and contribute to the burnout of so many formerly enthusiastic maintainers. Frankly, I've always tried and have succeeded in keeping up with the changes in the past, but I simply couldn't do it this cycle, because of the extent of changes and personal situations which demanded beyond even normal working hours. I say this in the hope that you will more carefully consider your tone and demands in the future in this regard. Lastly, if you'd like a temporary (or permanent) solution, I can suggest writing a script which uses the compiler API, which will allow you to use transformers. |
Hi @nonara, Thank you for the detailed response. As an open-source contributor and library maintainer I know exactly how you feel. I never meant to ask you to "work faster" and I apologize for the misunderstanding. Please note I asked how can "we" release it faster. My main feedback is that it's not clear what needed to be done in order to support version 5, nor a clear tasks or milestones that can help a community member such myself to hop on and contribute a few hours on the weekend. |
@moshest I appreciate that. Neuledge looks nice, btw! Unfortunately, this may be a complicated problem. I believe I have an approach worked out, though it's a bit in depth as well. There's a chance we can do it more simply, similar to how we have been. The MSFT engineer who made the changes isn't sure it will be that easy. One quick thing that would help to investigate that angle — if you want to see if you can get TS v5 to build without tree shaking and send me the compiled I do have one other person who's interested in helping with support and the rewrite. If you're interested, I can send a slack invite. |
You can send me one. I'm relying heavily on |
@nonara I think I manage to build Typescript without tree shaking but the differences aren't big so maybe I only manage to do so partially:
What I did is update the file + treeShaking: false,
- treeShaking: taskOptions.treeShaking, And built it using the command: npm run build:compiler I hope it helps. |
@moshest Thank you. I sent you a slack invite if you'd like to join. @AlCalzone built it with shaking disabled and sent the files on slack. Good news — I managed to get it to augment the new tsc. It runs properly and seem to be good. We need to test to be sure. Next steps are easier. Feel free to accept the invite and join in. |
How long until ts-patch supports V5? If it's still a ways off, I would like to contribute as well. Could you share the code blocks for the tests that need to pass and the work that needs to be done? In ttsc, we hacked createProgram. |
Thank you. It's almost there. We've overcome the large hurdle. Will update in this thread shortly. |
Hi all. I've updated the body of the original post with the latest update. We're close to release. |
@nonara I really don't want to bug you, but any info on the release? We're currently thinking about downgrading from TS 5 to 4, or just waiting for a couple of days until your new release hits the road. 🙂 |
@TankOs I appreciate that! I know everyone is ready, and I'm with you on that. I finished everything for the beta last night, and I'm working on some high level e2e tests right now so I can push out a beta. Shooting for today, but it definitely won't be long now. |
Hi all. We have a beta ready that works for both I'd really appreciate you trying it out and letting me know if it works for you. For now, you can use
Please note that this is an early release, intended to get everyone going. Everything should work, but I will be doing some more tuning and adding more comprehensive tests over the coming days. Thank you for helping to beta test! ttypescript migrationIf you want to try with a ttypescript project, you can use:
Or with ts-node, etc. via cli arg:
Helping outIf anyone would like to help build tests, please leave a comment on the v3-beta PR. I'm planning to organize how to approach those next week and would appreciate any help available. |
Oh wow, to be clear, this branch is taking the same approach as prettier and using the Have you considered taking yarn's approach to patching, and instead fork TS, make the changes in-tree, then diff the output packages to produce a patch? I feel like that would end up safer... and also maybe provide a baseline for a PR into TS itself if we want to eventually accept plugins upstream. |
@jakebailey Hey Jake! Thanks for taking a look. I'm going to respond in the v3 thread, so we can discuss there: |
When try to run on Same error be occured even when loading const runner = require("ts-node");
runner.register({
project: __dirname + "/tsconfig.issue.json",
compiler: "ts-patch",
});
require(`./issues/${process.argv[2]}.ts`); D:\github\samchon\typia\node_modules\ts-node\dist\configuration.js:91
const { fileExists = ts.sys.fileExists, readFile = ts.sys.readFile, skipProject = index_1.DEFAULTS.skipProject, project = index_1.DEFAULTS.project, tsTrace = index_1.DEFAULTS.tsTrace, } = rawApiOptions;
^
TypeError: Cannot read properties of undefined (reading 'fileExists')
at readConfig (D:\github\samchon\typia\node_modules\ts-node\dist\configuration.js:91:33)
at findAndReadConfig (D:\github\samchon\typia\node_modules\ts-node\dist\configuration.js:50:84)
at create (D:\github\samchon\typia\node_modules\ts-node\dist\index.js:146:69)
at Object.register (D:\github\samchon\typia\node_modules\ts-node\dist\index.js:127:19)
at Object.<anonymous> (D:\github\samchon\typia\test\issue.js:6:8)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) |
https://github.com/samchon/ts-patch-bug-report-93 git clone https://github.com/samchon/ts-patch-bug-report-93
cd ts-patch-bug-report-93
npm install
npm run build
npm run start @nonara, you can reproduce the bug from above repo and commands. |
@nonara Hi. I just now replaced ttypescript with this beta version to solve the previous problem. It works. it seems a syntax error. |
@hi-zhaolei Thanks for the report. We just discovered the same issue. That happens with lower Node versions, like Node 14. We'll be publishing a fix in a few hours. |
Hello, I am using typescript@5.0.4 with ts-patch@v3-beta, but the transformer https://github.com/yf-yang/ts-patch-not-working |
I'm sorry, that is my own fault, I didn't add |
@nonara When can I download regular v3? If there're som problem in |
Same happens when using env node -v = 16.17.0 |
Hi @nonara it appears I got booted out of the Slack channel due to not having Slack pro (it's unclear why I needed Pro to stay in the channel), so I'd like to check in and see what the v3 changes will entail. I saw your comment here and was interested in this part in particular:
Is there anything in v3 that I can experiment with in terms of these middleware hooks? Or is that a future, planned feature? Either way I'll test the v3 branch, hopefully tomorrow, to help out with the release. Thanks for all your work! |
for those who try to install it: |
This comment was marked as resolved.
This comment was marked as resolved.
It'd be awesome if ts directly supported this feature or facilitated this libs work, have you seen this? |
Someone is now taking the initiative and pushing for this feature: @nonara would you care to stop by and see what they're doing? 🙂 |
@mindplay-dk Unfortunately, transform API of TS 5.2 does not support full spec of TypeScript. For an example, you can't get detailed type info, due to TS 5.2 transform API does not support it. Most of properties and methods in Therefore, if such diet policy being kept, I think |
@samchon I am utterly confused by your description of the situation. Yes, tsc has fewer helpers included, but it's preposterous to state that tsc "does not support the full spec of TypeScript". Your continued misrepresentation of the way TypeScript works is extremely frustrating; I don't even know why I'm even bothering. |
microsoft/TypeScript#54276 (comment) This is my answer. Sorry for bothering you, but it is a break and critical change for 3rd party libraries. |
@samchon This workbench thing is implemented without any 3rd party libraries at all. Of the functions you've listed on microsoft/TypeScript#54276 (comment) as missing, most of them are provided as default exports on the compiler API (and there's enough there to generate runtime assertion logic) |
Thanks for reference. It is time to study for me. |
@sinclairzx81 By the way, most of above features are not exported as defaults. Instead, copying and pasting below files. Am I missing way? |
Hi all, To answer the question — I did see the proposal. You can see my responses on that thread, starting with this one: |
Running into this error trying to convert from ttypescript to ts-patch@3.0.0-rc2 (or beta3, same error either way):
This sadly is a re-throw losing the original stack trace. After some trial & error, I was able to observer more or less what the underlying call stack is. This is from before it crashes, but you can see the loop: nasty long stack trace
The trace above is from my "real" app, but I can reproduce the same problem with this minimal setup: reproducer filestsconfig.json: {
"compilerOptions": {
"allowUnreachableCode": false,
"declaration": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"forceConsistentCasingInFileNames": true,
"module": "commonjs",
"moduleResolution": "node",
"noEmitOnError": true,
"noImplicitReturns": true,
"preserveConstEnums": true,
"removeComments": false,
"resolveJsonModule": true,
"skipLibCheck": true,
"esModuleInterop": true,
"sourceMap": true,
"declarationMap": true,
"strict": true,
"target": "es2021",
"types": ["node"],
"lib": ["es2021"],
"rootDir": ".",
"outDir": "dist",
"plugins": [{ "transform": "ts-auto-mock/transformer" }]
}
} package.json: {
"dependencies": {
"@types/async": "^3.2.20",
"@types/node": "^14",
"async": "^3.2.4",
"ts-auto-mock": "^3.7.0",
"ts-patch": "3.0.0-rc2",
"typescript": "~5.0.4"
}
} index.ts: import { createMock } from 'ts-auto-mock';
interface X {
x(): void;
}
const mockX = createMock<X>(); |
Hi, I've finally gotten some time to work on my project using ts-patch, and rc2 looks to work perfectly when running patched However, I ran into an issue with patched export default function programTransformer(
program: Program,
host: CompilerHost | undefined,
config: PluginConfig,
{ ts: tsInstance }: ProgramTransformerExtras,
): Program {
const compilerOptions = program.getCompilerOptions();
const compilerHost = getPatchedHost(host, tsInstance, compilerOptions);
const rootFileNames = program.getRootFileNames().map(tsInstance.normalizePath);
console.log("CREATING PROGRAM")
return tsInstance.createProgram(rootFileNames, compilerOptions, compilerHost);
}; However, I've added console logs inside the return of the Here is my settings.json: {
"typescript.tsdk": "./node_modules/typescript/lib",
"typescript.tsserver.log": "verbose", // to debug, set to "verbose"
"typescript.enablePromptUseWorkspaceTsdk": true
} I have verified the patch is installed for all js files: $ ./node_modules/.bin/ts-patch check
Checking TypeScript v5.0.4 installation in $PROJECT\demo\node_modules\typescript
[+] tsc.js is patched with ts-patch version 3.0.0-rc2
[+] tsserver.js is patched with ts-patch version 3.0.0-rc2
[+] tsserverlibrary.js is patched with ts-patch version 3.0.0-rc2
[+] typescript.js is patched with ts-patch version 3.0.0-rc2 If needed, I can add more details about my project's weird use of ts-patch in the slack as I don't want to derail this issue. |
Hello, I migrating from ttypescript:
And has error: [70676:0x7fc848008000] 49489 ms: Scavenge (reduce) 4078.7 (4102.0) -> 4078.5 (4102.5) MB, 2.8 / 0.0 ms (average mu = 0.253, current mu = 0.145) allocation failure <--- JS stacktrace ---> FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory |
This comment was marked as outdated.
This comment was marked as outdated.
@nonara Works on When you clone and try to build my project Also, until beta3 version (including previous versions like {
"compilerOptions": {
"plugins": [
{ "transform": "../src/transform.ts" } // possible until beta3, but impossible since rc3
{ "transform": "../lib/trasnform.js" } // therefore, must target to compiled JS fil
]
}
} Reproducegit clone https://github.com/samchon/typia -b features/ts-patch-3.0.0-rc3
cd typia
npm install
npm run build
npm run build:test Error MessageError
at tspWrappedFactory (/home/runner/work/typia/typia/node_modules/typescript/lib/tsc.js:348:33)
at /home/runner/work/typia/typia/node_modules/typescript/lib/tsc.js:10[9](https://github.com/samchon/typia/actions/runs/5087037428/jobs/9142042595#step:7:10)318:33
at /home/runner/work/typia/typia/node_modules/typescript/lib/tsc.js:[10](https://github.com/samchon/typia/actions/runs/5087037428/jobs/9142042595#step:7:11)9405:61
at Array.map (<anonymous>)
at transformNodes (/home/runner/work/typia/typia/node_modules/typescript/lib/tsc.js:109405:50)
at emitJsFileOrBundle (/home/runner/work/typia/typia/node_modules/typescript/lib/tsc.js:[11](https://github.com/samchon/typia/actions/runs/5087037428/jobs/9142042595#step:7:12)0003:26)
at emitSourceFileOrBundle (/home/runner/work/typia/typia/node_modules/typescript/lib/tsc.js:109938:7)
at forEachEmittedFile (/home/runner/work/typia/typia/node_modules/typescript/lib/tsc.js:109692:26)
at emitFiles (/home/runner/work/typia/typia/node_modules/typescript/lib/tsc.js:1099[12](https://github.com/samchon/typia/actions/runs/5087037428/jobs/9142042595#step:7:13):5)
at emitWorker (/home/runner/work/typia/typia/node_modules/typescript/lib/tsc.js:117[15](https://github.com/samchon/typia/actions/runs/5087037428/jobs/9142042595#step:7:16)2:30) |
@samchon Thanks for trying it out and for your report! The rc does support ts transformers, but your case brought some edge cases to light. One of the more ambitious aspects of the new version is replacing need for ts-node, by doing ts compilation natively. Looks like I need to cover more edge cases in the require hook to cover implicit extensions, etc. I'm going to look closer at what ts-node is doing for the require hook, and hopefully I'll have it sorted in the next day or two. |
@nonara I'm getting the same too, but that just looks like you forgot to remove debug logging from the ts-patch/projects/patch/src/plugin/plugin-creator.ts Lines 101 to 105 in 8a8cb09
|
Not sure if this helps, @nonara, but the same error is logged many times with Typescript 5.1.3, with both beta3 or rc3. Reverting to TS 5.0.4 makes the errors go away.
PS Correction, the messages are there with rc3 regardless of TS version. Assuming it's due to the above console.log statement. |
Finally got the time to sit down with this for a few days and wrap it up. Thank you all for your patience and for helping with testing! If there are any issues, go ahead and file as a new issue. |
Hi, I'm a little late to this party. I'm trying to upgrade my project to TS5, and getting the error described here:
I tried the reccommended fix:
and it appears to make no difference at all; |
Update
Beta version is out! See the message below for detail:
The text was updated successfully, but these errors were encountered: