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
Error when opening TSX file: Cannot use JSX unless '--jsx' flag is provided #15814
Comments
I had this intermittently over the past few days (Windows 10 though). I think I solved it by adding... "include": [
"./src/ts/**/*"
] ...to |
Well I worked around it by adding When you open a TSX file (not a directory), you don't have a |
Ok, I believe the expected behavior would be:
Does that sound correct? |
Issue microsoft#15814 **Bug** 1. Open a tsx file on its own. 2. See a error about passing `--jsx` to tsc. **Fix** For implicit projects, assume `"jsx": "preserve"`. Closes microsoft#15814
@mjbvz In my case, the problem was there even though I did have (* I say "I believe" because it was really intermittent, so I'm not 100% sure what solved it. It's gone now though) |
Setting tsconfig.json jsx: "preserve" or "react" corrected vscode --jsx defect. {
"compilerOptions": {
"jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
}
} Tip: |
Steps to Reproduce:
This seems kind of ridiculous, given that VSC comes with TS built in. It doesn't know what to do with TSX files? It should automatically add the flag to
tsc
if it's processing a TSX file.The text was updated successfully, but these errors were encountered: