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

For almost every .tsx file in my project TS7026: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists. #44418

Closed
wegry opened this issue Jun 3, 2021 · 7 comments

Comments

@wegry
Copy link

wegry commented Jun 3, 2021

Bug Report

πŸ”Ž Search Terms

TS7026 no interface JSX.IntrinsicElements exists typescript 4.3 typescript 4.3 breaking changes.

πŸ•— Version & Regression Information

  • This changed between versions 4.2.4 and 4.3.2

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

The tsconfig.json in our project

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "importHelpers": true,
    "importsNotUsedAsValues": "error",
    "incremental": true,
    "isolatedModules": true,
    "moduleResolution": "node",
    "noEmit": true,
    "noEmitOnError": true,
    "jsx": "react-jsxdev",
    "lib": ["dom", "ES2020"],
    "allowJs": true,
    "module": "ES2020",
    "resolveJsonModule": true,
    "strict": true,
    "target": "ES2020",
    "types": [],
    "useDefineForClassFields": true
  },
  "include": [
    "./typings.d.ts",
    "./react-table-config.d.ts",
    "app",
    "components",
    "pages"
  ],
  "exclude": ["**/node_modules", "**/.*/"]
}

πŸ™ Actual behavior

Using Yarn 3 with PnP and webpack 5. We're also using the ts fork checker plugin. With a project that built in typescript@4.2.4, typescript@4.3.2 errors has an error in every tsx file.

It's usually

TS7026: JSX element implicitly has type 'any' because no interface 'JSX.IntrinsicElements' exists.

But there are a few

TS2322: Type '{ title: string; }' is not assignable to type 'Props'.
  Property 'children' is missing in type '{ title: string; }' but required in type '{ children: any; title?: string; }'.

and

TS2307: Cannot find module 'react/jsx-dev-runtime' or its corresponding type declarations.

πŸ™‚ Expected behavior

There might be a few broken things from breaking changes, but the project should compile.

@MartinJohns
Copy link
Contributor

This sounds like #41813. Tho that changed with version 4.2.1.

@wegry
Copy link
Author

wegry commented Jun 4, 2021

@MartinJohns is there a way to see which libraries are using a global namespace v. which are not? Maybe within the tsc command itself?

@wegry
Copy link
Author

wegry commented Jun 7, 2021

After doing a yarn up -R @types/react{,-dom} and bumping to @yarnpkg/berry@3.0.0-rc.5, these errors were no more with typescript@4.3.2.

edit: The updated versions that worked were @types/react@17.0.9 and @types/react-dom@17.0.6.

@wegry wegry closed this as completed Jun 7, 2021
@wegry
Copy link
Author

wegry commented Sep 1, 2021

I'm seeing this again with typescript@4.4.2.

@MartinJohns
Copy link
Contributor

Possibly related to #45681.

@abitwhy
Copy link

abitwhy commented Aug 24, 2022

This may be caused by IED (like VSCode). When an update prompt appears, try updating it first.

Updates:
In my case, this must be caused by renaming a markup variable. Related node_modules source code has been changed unexpectedly by
the renaming plugin. I fix it by reinstalling the node_modules. (The updating IDE mentioned above should also be indirectly updated node to fix the problem.)

@desprdo
Copy link

desprdo commented Oct 3, 2023

I just updated the VSCode and it solved the issue.

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

4 participants