[英]Why do I get a warning about JSX when I do not use JSX?
I have a Vue.js component file (the framework is Quasar) where, in <template>
I have the following block of code:我有一个 Vue.js 组件文件(框架是 Quasar),其中,在
<template>
我有以下代码块:
<q-btn
color="green"
label="save & continue editing"
@click="saveCase()"
/>
It is part of other code.它是其他代码的一部分。
This code is highlighted as an error by TypeScript:此代码被 TypeScript 突出显示为错误:
Details of the error:错误详情:
[{
"resource": "/D:/dev-pro/secops-cases/front/src/components/Case.vue",
"owner": "_generated_diagnostic_collection_name_#0",
"code": "17004",
"severity": 8,
"message": "Cannot use JSX unless the '--jsx' flag is provided.",
"source": "ts",
"startLineNumber": 108,
"startColumn": 11,
"endLineNumber": 112,
"endColumn": 13
}]
What does it mean?这是什么意思? I do not use React at all, just Vue.js, Quasar and TypeScript.
我根本不使用 React,只使用 Vue.js、Quasar 和 TypeScript。
<q-btn>
is the only element that is highlighted as errornous, any other element (generic or Quasar) is fine. <q-btn>
是唯一被突出显示为错误的元素,任何其他元素(通用或 Quasar)都可以。
Try to add a closing tag to avoid this warning:尝试添加一个结束标签以避免此警告:
<q-btn
color="green"
label="save & continue editing"
@click="saveCase()"
></q-btn>
This issue can be avoided also by adding "jsx": "preserve",
to the compilerOptions
entry in tsconfig.json
file:通过在
tsconfig.json
文件中的compilerOptions
条目中添加"jsx": "preserve",
也可以避免此问题:
{
"extends": "./.nuxt/tsconfig.json",
"compilerOptions": {
"strict": true,
"jsx": "preserve",
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.