Picture1 Please help, these errors are preventing my react app from compiling. How do I fix it? I also attached a picture of the App.tsx file What is another suggestion for taking care of this error?
Could not find a declaration file for module '@emotion/core'. 'c:/Users/nwoko/source/repos/QandA/QandAfrontend/frontend/node_modules/@emotion/core/dist/emotion-core.cjs.js' implicitly has an 'any' type.
Try npm i --save-dev @types/emotion__core
if it exists or add a new declaration (.d.ts) file containing declare module '@emotion/core';
ts(7016)
Type '{ children: Element[]; css: any; }' is not assignable to type 'DetailedHTMLProps<HTMLAttributes, HTMLDivElement>'. Property 'css' does not exist on type 'DetailedHTMLProps<HTMLAttributes, HTMLDivElement>'.ts(2322)
Picture2
Capitalizing on @sanderdebr suggestion,
I ran npm install --save @emotion/react
before changing the import line to import { jsx, css } from '@emotion/react'
and got rid of TypeScript error TS7016
I then added "types": ["@emotion/react/types/css-prop"]
in file tsconfig.json to get rid of the second ts error (2322)
Helped me:
tsconfig.json
"types": ["@emotion/react/types/css-prop"],
*.tsx
/** @jsxRuntime classic */
/** @jsx jsx */
import { jsx, css } from "@emotion/react";
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With