Closed luluhoc closed 1 year ago
so the problem is JavaScript and TypeScript Nightly extension in VSCODE, when disabled the problem is gone.
This happened to me. And as you said, it is the JavaScript and TypeScript Nightly
extension in vscode, but I didn't disable it to fix this. Just select the typescript version you're using so vscode know what you're using. In your case is 4.9.4
.
To make sure you are using typescript@4.9.4
:
Open a JavaScript or TypeScript file in VS Code.
In the VS Code command palette, run the TypeScript: Select TypeScript version
command.
Make sure you have Use Workspace version selected.
@wayn3r Thanks, run TypeScript: Select TypeScript version
and it worked for me. ✌️
This happened to me. And as you said, it is the
JavaScript and TypeScript Nightly
extension in vscode, but I didn't disable it to fix this. Just select the typescript version you're using so vscode know what you're using. In your case is4.9.4
.To make sure you are using
typescript@4.9.4
:Open a JavaScript or TypeScript file in VS Code.
In the VS Code command palette, run the
TypeScript: Select TypeScript version
command. Make sure you have Use Workspace version selected.
Thanks!! you saved my day 🙌
To expedite the triage process, we need everyone to follow the issue template and instructions.
When you clicked "Create New Issue", the issue form was pre-populated with a template and some instructions. We need you to read those instructions completely, follow them, and then fill in all the fields in that template.
We are not able to assist with issues that don't follow the template instructions as they represent a significantly larger amount of work compared to issues which are correctly specified. Thank you for understanding.
Thanks for the solution bro;)
Thank you @izakharov !
This happened to me. And as you said, it is the
JavaScript and TypeScript Nightly
extension in vscode, but I didn't disable it to fix this. Just select the typescript version you're using so vscode know what you're using. In your case is4.9.4
.To make sure you are using
typescript@4.9.4
:Open a JavaScript or TypeScript file in VS Code.
In the VS Code command palette, run the
TypeScript: Select TypeScript version
command. Make sure you have Use Workspace version selected.
That definitely saved my day 👍 Thank you! @wayn3r
This happened to me. And as you said, it is the
JavaScript and TypeScript Nightly
extension in vscode, but I didn't disable it to fix this. Just select the typescript version you're using so vscode know what you're using. In your case is4.9.4
.To make sure you are using
typescript@4.9.4
:Open a JavaScript or TypeScript file in VS Code.
In the VS Code command palette, run the
TypeScript: Select TypeScript version
command. Make sure you have Use Workspace version selected.
@wayn3r Thanks!! 👍👍
The underlying issue is still not fixed though, and it might come as a problem for someone who need to use TypeScript 5.0+. @luluhoc can you open a new issue following the issue template?
It's showing the same error to me TS1239: Unable to resolve signature of parameter decorator when called as an expression. Argument of type 'undefined' is not assignable to parameter of type 'string | symbol'.
Something to do with the new decorators I suppose.
I am also seeing this issue when trying to upgrade to TS5.
We are using experimental decorators.
Another missing functionality are parameter decorators. These are decorators with which method or constructor parameters can be decorated. This is a feature used by libraries like Angular, Nest.js, or type-graphql. As of shortly before the TypeScript 5 release, there are no separate proposals for this and no implementation in TypeScript. Because of this, Angular will not yet switch to the new decorators, but will continue using the experimental decorators, since the dependency injection feature is built on this pattern.
This happened to me. And as you said, it is the
JavaScript and TypeScript Nightly
extension in vscode, but I didn't disable it to fix this. Just select the typescript version you're using so vscode know what you're using. In your case is4.9.4
.To make sure you are using
typescript@4.9.4
:Open a JavaScript or TypeScript file in VS Code.
In the VS Code command palette, run the
TypeScript: Select TypeScript version
command. Make sure you have Use Workspace version selected.
It worked for me too. Thanks man!
Hi, thanks for the fix.
One thing I don't understand though is the fact that I already had this line "typescript.tsdk": node_modules/typescript/lib"
in my project settings but it was not taken into account.
Isn't it a bug ?
It happens to me even though I don't use JavaScript and TypeScript Nightly
extension. Try do disable all extensions that I have, still does not work.
My ts version is "typescript": "~4.6.3"
Code that causes the issue
@Inject(forwardRef(() => UsersService))
A coworker of mine fixed it by changing the version of Typescript in vscode.
One thing I don't understand though is the fact that I already had this line
"typescript.tsdk": node_modules/typescript/lib"
in my project settings but it was not taken into account.Isn't it a bug ?
@ajubin I was caught off-guard too.
But this appears to be an expected behavior, according to the VS Code doc:
The
typescript.tsdk
workspace setting only tells VS Code that a workspace version of TypeScript exists. To actually start using the workspace version for IntelliSense, you must run the TypeScript: Select TypeScript Version command and select the workspace version.
I added "experimentalDecorators": true
to my compilerOptions
in tsconfig.json
. Worked with VSCodes typescript version 5.0.4
I tried all the options, but it doesn't work
@GareginAv, it doesn't work for me too. But I was import the @Query from wrong path.
Now it is correct and works for me.
I'm experiencing the same issue, it's seems like a bug in decorators from 5.0. I'm having this error specifically with the tsyringe decorators
This happened to me. And as you said, it is the
JavaScript and TypeScript Nightly
extension in vscode, but I didn't disable it to fix this. Just select the typescript version you're using so vscode know what you're using. In your case is4.9.4
.To make sure you are using
typescript@4.9.4
:Open a JavaScript or TypeScript file in VS Code.
In the VS Code command palette, run the
TypeScript: Select TypeScript version
command. Make sure you have Use Workspace version selected.
I love u bro
if the above didn't solve your problem completely then check out this from Stackoverflow, it was really helpful https://stackoverflow.com/questions/38271273/experimental-decorators-warning-in-typescript-compilation
If you are getting this warning while making a typegoose model, add these three options to your tsconfig.json.
"strictPropertyInitialization": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
@wayn3r, TypeScript: Select TypeScript version
works for me, Thank you Bro!
I was still getting the error:
Experimental support for decorators is a feature that is subject to change in a future release. Set the 'experimentalDecorators' option in your 'tsconfig' or 'jsconfig' to remove this warning.ts(1219)
for an @NgModule()
decorator even after TypeScript: Select TypeScript version
got rid of the initial error.
What finally worked was setting:
"js/ts.implicitProjectConfig.experimentalDecorators": true
in VSCode's settings.json
Although VS Code is a great editor for TypeScript projects, it needs a kick every now and again. Often, without warning, certain files cause it to freak out and complain. Mostly the fix seems to be to save and close all open files, then open tsconfig.json. After that you should be able to re-open the offending file without error. If it doesn't work, lather, rinse, and repeat.
If your tsconfig.json specifies its source files using the files array, IntelliSense will only function correctly if the file in question is referenced such that VS Code can find it by traversing the input file tree.
Edit: The 'reload window' command (added ages ago now) should solve this problem once and for all.
I have faced the same issue today, the fix was just reloading the Typescript server
CMD + SHIFT + P
then choose TypeScript: Restart TS Server
If @wayn3r solution didn't solve your problem, you may want to check your tsconfig.json (which should already have "experimentalDecorators": true) and make sure you have the following:
{
"include": [
"src/**/*.ts",
]
}
If @wayn3r solution didn't solve your problem, you may want to check your tsconfig.json (which should already have "experimentalDecorators": true) and make sure you have the following:
{ "include": [ "src/**/*.ts", ] }
This fixed for me!
Thank you very much!!
I added
"experimentalDecorators": true
to mycompilerOptions
intsconfig.json
. Worked with VSCodes typescript version 5.0.4
yep,this works for me.The document here:https://www.typescriptlang.org/tsconfig/#experimentalDecorators
Although VS Code is a great editor for TypeScript projects, it needs a kick every now and again. Often, without warning, certain files cause it to freak out and complain. Mostly the fix seems to be to save and close all open files, then open tsconfig.json. After that you should be able to re-open the offending file without error. If it doesn't work, lather, rinse, and repeat.
If your tsconfig.json specifies its source files using the files array, IntelliSense will only function correctly if the file in question is referenced such that VS Code can find it by traversing the input file tree.
Edit: The 'reload window' command (added ages ago now) should solve this problem once and for all.
I tried all the above in vain; this is what finally worked for me. ty.
This save my entire day !!!
I'm getting the error when I'm decorating the class in nestjs service. I'm using typescript 4.9.4
The Typescript is compiling without errors, and I'm getting this problem only in VSCode.
My tsconfig
My Class
I tried reinstalling typescript and removing node modules, but the problem persists.