-
Notifications
You must be signed in to change notification settings - Fork 11
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
[BUG] TS 4.9 - "[ERR] tst-reflect: You call getType() method directly..." error when following base usage examples. #84
Comments
Hi, It's caused by TS 4.9, they changed something in the transformer API. I'm going to debug it this week. I hope it's just a minor change... Until then you have to downgrade to TS 4.8.x. |
awesome thanks for the quick response, I was able to get it working with 4.8 |
Any news? It does not work even with TS 4.8.4 |
@stepansib |
Same issue |
@fiftin If you are not able to make it work, please create a repro on StackBlitz and I'll take a look what the issue is. 🙂 |
@Hookyns Your link is broken. It looks like a |
@lewispham You can use ts-patch for sure. As far as I know ts-patch is compatible with ttypescript out of the box. |
@Hookyns Yes the example. I've just changed the [ERR] tst-reflect: You call getType() method directly. You have probably wrong configuration, because tst-reflect-transformer package should replace this call by the Type instance.
If you have right configuration it may be BUG so try to create an issue.
If it is not an issue and you don't want to see this debug message, create field 'tst-reflect-disable' in global object (window | global | globalThis) eg. `window['tst-reflect-disable'] = true;` Here is my {
"name": "node-starter",
"version": "0.0.0",
"scripts": {
"start": "npx tspc && node index.js",
"test": "echo \"Error: no test specified\" && exit 1",
"prepare": "ts-patch install -s"
},
"dependencies": {
"tst-reflect": "^0.12.0"
},
"devDependencies": {
"tst-reflect-transformer": "^0.12.0",
"ts-patch": "^3.0.2",
"typescript": "^5.2.2"
}
} URL: https://stackblitz.com/edit/tst-reflect-example-ts522-s92ole |
@lewispham In case you are willing to help with this you can try to add at least some console.log() to |
@Hookyns It's only called when I run import { getType, Type } from "tst-reflect";
const type: Type = getType();
console.log("TYPE", type); |
It should be called each time you run EDIT: nvm; I didn't noticed there are logs:
so it is called... 🤔 |
@Hookyns I meant that when I added |
I think I found it. if (!ts.isSourceFile(node)) {
return node;
} because node is from TS 5 but the ts.isSourceFile is from TS 4.9 and it returns false for that TS 5 node. |
Glad to hear that. Would removing the check fix the issue? |
Nope. tweaked demo It ends with some error. So I would have to update typescript to make it work but there were quite a lot of changes in the typescript API. It's something I don't want to do in this old ts-reflect version. If it is option for you, join the closed alpha and try the new system. See #78. PS: New system is not yet as stable as this old tst-reflect version. |
OK I see. Please add me to that project. Thank you. |
Same issue, typescript 4.8.3 |
Hello @GulgDev, This is working 4.8 demo: StackBlitz |
having the same issue here with [email protected] it works fine when i use [email protected] with [email protected] |
Hi @hosam95, PS: You may be interested in #78 |
Describe the bug
When following the README examples for using
getType
I continuously get the error[ERR] tst-reflect: You call getType() method directly. You have probably wrong configuration, because tst-reflect-transformer package should replace this call by the Type instance.
I decided to clone the whole repo and to run the examples to see if maybe it was something with my configuration but I get the same issue when trying to run the
base-example
.The code causing the problem
To Reproduce
Steps to reproduce the behavior:
Expected behavior
I expect that the type information would print out and not get an error.
Runtime:
Additional context
I'm checking out this library because I would like to use it with an express server, if that is not possible please let me know.
The text was updated successfully, but these errors were encountered: