Skip to content
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

JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.ts(7026) #537

Closed
chrissyast opened this issue Dec 5, 2021 · 18 comments

Comments

@chrissyast
Copy link

Describe the bug
The above error is shown for any 'native' html (span, div) tag, but not for Vue components such as template, MyComponent.
I have the exact same repo on three machines (Two W10, one Mac) and it only happens on one (W10), so it doesn't seem to be anything wrong with the config. Nothing has been changed

To Reproduce
Difficult to provide exact reproduction because it is only happening on one environment out of three, but minimal repo provided anyway https://github.com/chrissyast/nuxt-typescript/tree/minimal_example

  1. Clone
  2. yarn install
  3. Open pages/index.vue

Expected behavior
No errors on <div> tag

Screenshots
image

Additional context
A lot of the google search results were related to React and suggested it was a types issue https://stackoverflow.com/a/59046713/8940624, but I have added "@nuxt/types" to tsconfig.
On both the failing and working PC, tsc --version yielded tsc' is not recognized as an internal or external command,. I installed typescript on the failing PC anyway but still the issue persists

@MarceCandil
Copy link

same issue here

@jihogrammer
Copy link

If you are using "volar", try using "vutur".

@chrissyast
Copy link
Author

chrissyast commented Dec 11, 2021

@jihogrammer Disabling Volar worked for me. I wasn't even aware I had the extension as it was installed by default in my company's workspace config. Thanks!

@FossPrime
Copy link

FossPrime commented Feb 24, 2022

This issue is unrelated to typescript... but, for anyone who stumbles on this issue:

Uninstalling volar is no longer an acceptable answer... vue-tsc will also produce this error.
install @vue/runtime-dom and then in a tsconfig.node.json referenced file, experimental mode

Here's my tsconfig.node.json:

{
  "compilerOptions": {
    "composite": true,
    "module": "esnext",
    "moduleResolution": "node"
  },
  "include": [
    "vite.config.ts"
  ],
  "vueCompilerOptions": {
    "experimentalCompatMode": 2, // delete after migrating to vue3 (or nuxt3)
    "experimentalTemplateCompilerOptions": {
      "compatConfig": {
        "MODE": 2
      } // delete after migrating to vue3 (or nuxt3)
    }
  }
}

@charlesbrandt
Copy link

I had been running the vue application in a docker container and the node modules were separate. Once I installed the node modules in the local directory, I restarted VS Code and it found the modules and the error went away.

@IsraelOrtuno
Copy link

This issue is unrelated to typescript... but, for anyone who stumbles on this issue:

Uninstalling volar is no longer an acceptable answer... vue-tsc will also produce this error. install @vue/runtime-dom and then in a tsconfig.node.json referenced file, experimental mode

Here's my tsconfig.node.json:

{
  "compilerOptions": {
    "composite": true,
    "module": "esnext",
    "moduleResolution": "node"
  },
  "include": [
    "vite.config.ts"
  ],
  "vueCompilerOptions": {
    "experimentalCompatMode": 2, // delete after migrating to vue3 (or nuxt3)
    "experimentalTemplateCompilerOptions": {
      "compatConfig": {
        "MODE": 2
      } // delete after migrating to vue3 (or nuxt3)
    }
  }
}

I can say that this definitely works 🔥

@eavan5
Copy link

eavan5 commented Mar 10, 2022

I use the quasar framework, version 2.5.5. I have the same problem as you. My solution is to update the version of Vue, and this problem will be solved immediately

@PeteJStewart
Copy link

This issue is unrelated to typescript... but, for anyone who stumbles on this issue:

Uninstalling volar is no longer an acceptable answer... vue-tsc will also produce this error. install @vue/runtime-dom and then in a tsconfig.node.json referenced file, experimental mode

Here's my tsconfig.node.json:

{
  "compilerOptions": {
    "composite": true,
    "module": "esnext",
    "moduleResolution": "node"
  },
  "include": [
    "vite.config.ts"
  ],
  "vueCompilerOptions": {
    "experimentalCompatMode": 2, // delete after migrating to vue3 (or nuxt3)
    "experimentalTemplateCompilerOptions": {
      "compatConfig": {
        "MODE": 2
      } // delete after migrating to vue3 (or nuxt3)
    }
  }
}

This worked perfectly for me.

botatooo added a commit to projetpatriotes/projetpatriotes.github.io that referenced this issue May 3, 2022
@zhangyahan
Copy link

This issue is unrelated to typescript... but, for anyone who stumbles on this issue:
Uninstalling volar is no longer an acceptable answer... vue-tsc will also produce this error. install @vue/runtime-dom and then in a tsconfig.node.json referenced file, experimental mode
Here's my tsconfig.node.json:

{
  "compilerOptions": {
    "composite": true,
    "module": "esnext",
    "moduleResolution": "node"
  },
  "include": [
    "vite.config.ts"
  ],
  "vueCompilerOptions": {
    "experimentalCompatMode": 2, // delete after migrating to vue3 (or nuxt3)
    "experimentalTemplateCompilerOptions": {
      "compatConfig": {
        "MODE": 2
      } // delete after migrating to vue3 (or nuxt3)
    }
  }
}

I can say that this definitely works 🔥

thank you very much,It helped me.

@infinite-system
Copy link

All the solutions above don't work for me anymore.

@hregibo
Copy link

hregibo commented Jan 13, 2024

Same for me, issue appeared randomly while it worked fine before. Not in VSCODE, but in Docker. The docker build fails with this error. (please note i use vue3 + vite using the generated app for a vue 3 project)

@Reeska
Copy link

Reeska commented Jan 17, 2024

Did you try to upgrade vue-tsc to the last version ?
I had this error as well, but it's gone now after the upgrade.

@yokusrelynkno
Copy link

Did you try to upgrade vue-tsc to the last version ? I had this error as well, but it's gone now after the upgrade.

This worked for us, thank you!

@hregibo
Copy link

hregibo commented Jan 24, 2024

Did you try to upgrade vue-tsc to the last version ? I had this error as well, but it's gone now after the upgrade.

This solved the problems in my case too, thank you so much!

@MiladJoodi
Copy link

All the solutions above don't work for me.

@sunjinbo321
Copy link

Did you try to upgrade vue-tsc to the last version ? I had this error as well, but it's gone now after the upgrade.

Thank you, I am Chinese and I have resolved this issue by setting the Vue to version 3.3.4 and the Vue TSC to version 1.8.16

@chrissyast
Copy link
Author

Did you try to upgrade vue-tsc to the last version ? I had this error as well, but it's gone now after the upgrade.

Thank you, I am Chinese and I have resolved this issue by setting the Vue to version 3.3.4 and the Vue TSC to version 1.8.16

Does the fix only work for Chinese people?

@sunjinbo321
Copy link

Did you try to upgrade vue-tsc to the last version ? I had this error as well, but it's gone now after the upgrade.

Thank you, I am Chinese and I have resolved this issue by setting the Vue to version 3.3.4 and the Vue TSC to version 1.8.16

Does the fix only work for Chinese people?

You misunderstood. Of course, the plan is suitable for everyone. I just want to express my gratitude to your issue for solving the problem for me. When I said where I come from, it was a friendly gesture. I apologize for any misunderstanding caused

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests