-
Notifications
You must be signed in to change notification settings - Fork 12.6k
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
tsc 5.2.2 compiler .tsx
file bug
#56076
Comments
This is working as intended. See: https://www.typescriptlang.org/docs/handbook/compiler-options.html
You're specifying input files, so your
Also, this is not a crash. The compiler operates correctly and returns an error, it does not crash. |
@MartinJohns after I add the {
"name": "ts-playground",
"version": "1.0.0",
"description": "ts",
"main": "index.js",
"scripts": {
"dev": "tsc --jsx='react' ./src/index.ts",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"ts"
],
"author": "xgqfrms",
"license": "MIT",
"devDependencies": {
"@types/node": "^20.8.4",
"@types/react": "^18.2.28",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^5.2.2"
}
} eric@rpi4b:~/Desktop/ts-playground $ npm run dev
> ts-playground@1.0.0 dev
> tsc --jsx ./src/index.ts
error TS6046: Argument for '--jsx' option must be: 'preserve', 'react-native', 'react', 'react-jsx', 'react-jsxdev'.
eric@rpi4b:~/Desktop/ts-playground $ vim package.json
eric@rpi4b:~/Desktop/ts-playground $ npm run dev
> ts-playground@1.0.0 dev
> tsc --jsx=react ./src/index.ts
error TS5023: Unknown compiler option '--jsx=react'.
Questions & Tried# use `tsc` CLI β
$ npx tsc --jsx=react ./src/index.ts
$ npx tsc --jsx='react' ./src/index.ts # CLI options order bugβ
$ npx tsc ./src/index.ts --jsx=react
$ npx tsc ./src/index.ts --jsx='react'
error TS5023: Unknown compiler option '--jsx=react'.
Answer
# β
usage
$ npx tsc ./src/index.ts --jsx react
# β usage
$ npx tsc ./src/index.ts --jsx='react'
{
"name": "ts-playground",
"version": "1.0.0",
"description": "ts",
"main": "index.js",
"scripts": {
"dev": "tsc --jsx react ./src/index.ts",
"dev-cli": "tsc ./src/index.ts --jsx react",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"ts"
],
"author": "xgqfrms",
"license": "MIT",
"devDependencies": {
"@types/node": "^20.8.4",
"@types/react": "^18.2.28",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"typescript": "^5.2.2"
}
} |
use
|
π Search Terms
"tsc", ".tsx"
π Version & Regression Information
β― Playground Link
No response
π» Code
$ tree -I node_modules . βββ package.json βββ package-lock.json βββ src βΒ Β βββ auto-login βΒ Β βΒ Β βββ index.tsx βΒ Β βββ index.ts βββ tsconfig.json
π Actual behavior
π Expected behavior
no error.
Additional information about the issue
https://www.typescriptlang.org/tsconfig
https://www.typescriptlang.org/docs/handbook/jsx.html
https://stackoverflow.com/questions/50432556/cannot-use-jsx-unless-the-jsx-flag-is-provided
The text was updated successfully, but these errors were encountered: