score:0
<alert onclose={handlemessageclose}
severity={messagetype == "success" ? "success" : messagetype == "error" ? "error" : messagetype == "info" ? "info" : "warning"}
sx={{ width: '100%' }}>
{message}
</alert>
score:4
you're wrapping your color
value in a template literal, therefore converting it to a regular string. use this instead:
<statusbutton title={`${blog.status.ispublished ? 'online' : 'offline'}`} color={blog.status.ispublished ? 'success' : 'warning'}/>
typescript should in that case be smart enough to see 'success'
and 'warning'
as constants that count as colors
.
Source: stackoverflow.com
Related Query
- How to fix the error argument of type string or undefined is not assignable to parameter of type string using typescript and react?
- How to fix error argument of type undefined is not assignable to parameter of type 'string or () => string usng typescript and react?
- getting error : Argument of type '() => () => boolean' is not assignable to parameter of type 'EffectCallback'
- Type 'Element | undefined' is not assignable to type 'ReactElement<any, string | ((props: any)
- CombineReducers with Typescript returns error "Argument of type is not assignable to parameter of type 'ReducersMapObject'"
- React Typescript error in TextArea : Type 'string' is not assignable to type number
- React Hook Form Error - Type 'UseFormRegister<FormData>' is not assignable to type 'LegacyRef<HTMLInputElement> | undefined'
- Argument of type 'string | null' is not assignable to parameter of type 'ValueFn<SVGPathElement, Datum[], string | number | boolean | null>'
- TS2322 - false | Element is not assignable to type ReactElement. Error does not consistently appear in app?
- Getting an error Argument of type 'unknown' is not assignable to parameter of type 'Error | null'
- Creating reusable Button Component with React and Typescript with not assignable type error
- Type string is not assignable to type
- TypeScript/React. ERROR Type '{ key: number; }' is not assignable to type ILink (SFC Component)
- How to fix the type error Type '(string | Element) [] is not assignable to type 'string | Element | undefined' using react and typescript?
- Typescript error 'argument of type is not assignable to parameter of type'
- TypeScript error : Type '.....' is not assignable to type 'IntrinsicAttributes & Number'
- Promise.all error - Type '(Video | undefined)[]' is not assignable to type 'Video[]'
- Using state and includes in React gives Argument of type 'number' is not assignable to parameter of type 'never' error
- Withrouter Error using function component and typescript jsx.element' is not assignable to parameter of type routecomponentprops
- Is Missing in Type {}, but Required in Type ' ' & ' ' Is not Assignable to String Index Type ' ' Errors
- React Typescript error Type '{ id: number; title: string; function(): void; }' is not assignable to type 'null'
- Typescript: Type 'null' is not assignable to type error
- Cryptic Typescript compiler error using React: 'ComponentClass<StyledComponentProps<{}>>' is not assignable to type 'typeof MyComponent'
- getting error : void' is not assignable to type 'FC<IPickWinnerProps>' in react js
- Error argument of type 'Item' is not assignable to parameter of type 'string'. TS2345
- getting error :Type '[null, Dispatch<SetStateAction<null>>]' is not assignable to type in typescript react
- Type '(isOpen: boolean) => void' is not assignable to type 'boolean'. Error when using Modal in reactjs
- React router dom type error / FC{} | ReactNode is not assignable to type ReactNode
- Initial value of function in useRef throws an error cause "Argument of type '() => never' is not assignable to parameter of type 'T'."
- react typescript error 'Type '{ ... }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<...>
More Query from same tag
- How to update an existing array of objects (add a new object to the array) with the useState hook?
- How would I create a select box inside a div without the dropdown?
- How do I make a single child div scroll?
- Filtering a fetched list from an API using React Query
- How to set state before render with react(redux)
- Axios in React for storing response for future use
- React Paginate Second Instance on same page does not re render
- Attempted import error: 'GoogleAuthProvider' is not exported from 'firebase/auth'
- Mongo DB - newly created documents are not inserted in order
- Facebook React: Invariant Violation and elements than didn't mount automatically
- How to toggle state between 2 React components
- Avoid re-rendering in React when switching between tabs
- Updating a React state from child component function
- NGINX proxy pass to React App not working
- How to properly style Recharts in React-issue centering and controlling size?
- Invariant Violation with static text plus state value in OPTION tag content
- How to cancel subsequent requests in axios interceptor?
- how to use new set in react with a async Data in react
- What is proper way to use react hooks when calling javascript functions?
- Is there a way to make the dot badge in Material-UI bigger?
- Gatsby - Get multiple images from an array in a Markdown file
- How to use an imported function as a promise. Object(...)(...).then is not a function
- How do I stop state store data from accumulating in a redux component every time I navigate to it using react router
- Is there a better way to get different data from an API in the same component based on data type?
- How can I remove an existing <Marker> component from <Map> in react js?
- Dynamic filtering in Typescript React
- Is it possible to scrape a React website (Instagram) with Cheerio?
- Why react dev tools Profiler dont show me component props?
- How to remove colons in Form.input antd design react?
- React and TypeScript - How to render without wrapping in a parent div?