PS: yes, I already tested many configurations and things I found here, like this topic: VSCode Intellisense, snippets, suggestions are not working in JSX, TSX files
None of them are reporting exactly my case, and also nothing I tried solved the issue (not even sure if IS an issue or just a limitation)
I noted that no matter what, the IntelliSense only works on some particular places inside a React file (JS or JSX, doesn't matter) Check the image below:
As you can see, it seems that IntelliSense only engages when it detects the JS properly, inside a return. But for some reason the exact same method inside a function declaration at the top has no widget/tooltip, and neither the autocomplete/autosuggests work.
settings.json
, same behavior.Hopefully anyone has any tips on how to get this working - maybe a config I don't know, maybe a custom extension, not sure.
Thanks
Look at the 'e' type in onChange handler (mouse over it)
Then put that type in the function that you created
const textChange: (e: /* here paste the type */) => {
...
Typescript can't infer where your function will be used so you need to define the type of your params
The types or (inference/intellisense) that you are getting are there because there are some TS files that are checked under the hood
In this case for onChange React prop it finds that in
node_modules/@types/react/index.d.ts
And for event values that are declared in onChange (inline)
node_modules/typescript/lib/lib.dom.d.ts