score:1
if you are using material-ui v1 then you do not use the @types anymore the types are shipped with the package. simply point your tsconfig file to it in the "types": "material-ui"
and have node_modules
in the "typeroots"
section.
example
"compileroptions": {
"typeroots": [
"node_modules/@types",
"node_modules"
],
"types": [
"node", "jest", "lodash", "react",
"react-dom", "react-redux", "redux-logger", "material-ui",
"react-router-dom", "react-router-redux",
"redux", "binary-type-tree", "redux-form",
"tedb", "react-tap-event-plugin",
"react-hot-loader", "material-ui-icons"
],
"outdir": "dist"
},
"include": [
"src",
"node_modules/**/*.d.ts",
"node_modules/@types/**/*.d.ts"
],
this of course will change your project, the project had almost a complete rewrite and i had to rework my project to use v1.
score:1
<muithemeprovider theme={theme}>
the type definition for mui
is out of date / incorrect. this wouldn't be a problem if mui was written in typescript.
more
be the change and provide a fix here : https://github.com/definitelytyped/definitelytyped/blob/master/types/material-ui/index.d.ts as a pr.
prefer typescript first packages
e.g. blueprintjs as they do not suffer from such problems. more : https://basarat.gitbooks.io/typescript/content/docs/quick/nodejs.html
score:2
the answer by @blaine garrett is very good but i fixed the error by using
import { makestyles } from '@material-ui/core';
as using import { makestyles } from '@material-ui/core/styles';
was giving me another error.
score:2
this worked for me
import { makestyles } from "@material-ui/styles";
const usestyles = makestyles((theme: theme) => ({
}));
score:45
for anyone running into a similar error message in 2020, my issue was that i was importing makestyles from the @material-ui/styles package. switching to the preferred @material-ui/core/styles package gives you the correct types.
eg. change:
import { makestyles } from '@material-ui/styles';
to
import { makestyles } from '@material-ui/core/styles';
see this github issue discussing the preferred import. i believe the former was introduced with mui 3 as a temporary shim for some style conversions they were working on.
Source: stackoverflow.com
Related Query
- Typescript complains Property does not exist on type 'JSX.IntrinsicElements' when using React.createClass?
- Property 'theme' does not exist when using typescript
- Material UI v5 - Property 'spacing' does not exist on type 'DefaultTheme' when using a custom theme
- Typescript error "Property does not exist on type 'JSX.IntrinsicElements'" when using native web component
- TS2339: Property 'PropTypes' does not exist on type 'typeof React' when porting to Typescript
- Property does not exist on state - Using React Router Hooks with TypeScript
- Property 'rawValue' does not exist on type 'EventTarget & HTMLInputElement' error while using typescript with cleave.js
- Property 'then' does not exist on type 'RelayObservable<unknown>'. when I try to fetch data using relay in react. I don't know why this error come
- How to fix typescript error 'name' does not exist in type 'ByRoleOptions' when querying by accessible name using getByRole in react-testing-library
- Property '' does not exist on type 'string' when using makestyles @mui
- Getting Property does not exist on JSX intrinsic elements when using TSS with Javascript (no TS)
- TypeScript error: Property 'X' does not exist on type 'Window'
- typescript + react/redux: property "yyy" does not exist on type 'intrinsicattributes & intrinsicclassattributes
- TypeScript error after upgrading version 4 useParams () from react-router-dom Property 'sumParams' does not exist on type '{}'
- Trigger click in Typescript - Property 'click' does not exist on type 'Element'
- Reactjs, Typescript - property does not exist on child component
- TypeScript error: Property 'children' does not exist on type 'ReactNode'
- TypeScript error: Property 'scrollIntoView' does not exist on type 'never'. TS2339
- Property 'value' does not exist on type 'never'. when use useRef hook in mui
- Typescript Error: TS2339: Property 'span' does not exist on type 'JSX.IntrinsicElements'
- useRef Typescript error: Property 'current' does not exist on type 'HTMLElement'
- Property 'value' does not exist on 'EventTarget' in TypeScript
- TypeScript Property 'props' does not exist
- Typescript and Google AMP? Property 'amp-img' does not exist on type 'JSX.IntrinsicElements'
- State using React Typescript: Property does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes
- react hooks and typescript - Property '***' does not exist on type 'never'
- TS2339: Property 'focus' does not exist on type '{}'. with React typescript
- Typescript error: Property 'flat' does not exist on type '[string, unknown][]'
- TypeScript: Property 'X' does not exist on 'Window & typeof globalThis': suggested solution using 'declare global' gives me error
- Property 'name' does not exist on type 'EventTarget' - React + TypeScript
More Query from same tag
- Styled Component Button Extension
- Parsing an api response
- How to change a button using Redux
- How to read the zip file contents in react application using jszip preferably
- React Native - stickyHeaderIndices not working for SectionList
- React state variable not accurate after set state in useState hook
- What are the differences between the code wrapped in useEffect(fn, []) and the code outside useEffect(fn, [])?
- .push() is improperly pushing twice on Next.js
- Accessing a property from an array of objects stored in state in React
- how to simplify the length of the state in react js
- How to pass down props to function in ReactJS
- Passing data to custom elements with React Bootstrap
- I am trying to work with useQuery in Typescript
- useCallback with args passed in
- How can I take a group of nested JSON objects and append their data to an editable text field?
- Redux store does not have a valid reducer, with combineReducers and valid reducer
- How to toggle between display: none and display:block on click
- React how to highlight multiple components by using 1 ref
- A .map stacking cards instead of them being side by side
- How to change useless repeat Route
- React dobble update so my useContext = undefined
- HMR in asp.net core with React
- Remove movement/draggable scroll on google maps react
- react calling a function in a child component
- I AM HAVING ERROR WHEN TRYING TO MAP A DATA IN REACT . Objects are not valid as a React child (found: object with keys {children}), How do i solve it?
- React with Svg vertical stacked barchart (no third party library)
- Get figure from function and set it as state once user types in input
- Using x-editable with reactjs, how to call editable function on items?
- How to prevent non-deterministic state updation in Redux?
- Proxy in development mode of React won't redirect