VS Code showing errors on template tag

Viewed 5967

Please does anyone know how to resolve this error??

TypeScript intellisense is disabled on template. To enable, configure `"jsx": "preserve"` in the `"compilerOptions"` property of tsconfig or jsconfig. To disable this prompt instead, configure `"experimentalDisableTemplateSupport": true` in `"vueCompilerOptions"` property.volar
5 Answers

in jsconfig.json

    {
  "compilerOptions": {
    "target": "es5",
    "module": "esnext",
    "baseUrl": "./",
    "moduleResolution": "node",
    "paths": {
      "@/*": [
        "src/*"
      ]
    },
    "lib": [
      "esnext",
      "dom",
      "dom.iterable",
      "scripthost"
    ],
    "jsx": "preserve"
  }
}

write --> "jsx": "preserve"

You need to add "jsx": "preserve" to your config under the compilerOptions section. This is slightly different depending on how your project is set up.

This is the officially recommended solution.

If you're using a .tsconfig it will look like this:

{
  "compilerOptions": {
    "jsx": "preserve"
  }
}

With Nuxt 3 your .tsconfig will look closer to this:

{
  // https://v3.nuxtjs.org/concepts/typescript
  "extends": "./.nuxt/tsconfig.json",
  "compilerOptions": {
    "jsx": "preserve"
  }
}

If you're using a .jsconfig then it will be more like this:

{
  "compilerOptions": {
    "module": "commonjs",
    "target": "es6",
    "jsx": "preserve"
  },
  "include": ["src/**/*"]
}

I wrote a short blog post on solving this here: michaelnthiessen.com/typescript-intellisense-error

On file jsconfig.json

add:

"vueCompilerOptions": { "experimentalDisableTemplateSupport": true },

In your jsconfig.json, put the following

In your jsconfig.json, put the following

"jsx": "preserve"

I was getting the same error write "jsx": "preserve" in jsconfig.json file did work.

Related