score:0
Accepted answer
you have to tell TypeScript that the keyword name is a key of type ModuleType.
For that you have to write like this,
let name : keyof ModuleType = 'Whatever value it contains';
const formDataType = formData[name].type;
// or
const formDataType = formData[<keyof ModuleType>name].type;
Source: stackoverflow.com
Related Query
- react typescript error - element implicitly has an any type because expression of type string cant be used to index type {}
- error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index 'ModuleType'
- Element implicitly has an 'any' type because expression of type 'any' can't be used to index type '{ 1: Element; 2: Element; 3: Element; }'. TS7053
- Typescript error in map(): Element implicitly has an 'any' type because expression of type 'string' can't be used to index type
- error TS2602: JSX element implicitly has type 'any' because the global type 'JSX.Element' does not exist
- TS | Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Record<SecurityMode, boolean>'
- Element implicitly has an 'any' type because expression of type 'any' can't be used to index type
- Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Palette'
- Element implicitly has an 'any' type because expression of type 'string' can't be used to index type React Typescript
- How do I fix the error "Element implicitly has an 'any' type because the expression of type
- Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'typeof
- Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{...}'
- Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'Breakpoints'
- how fix Element implicitly has an 'any' type because expression of type 'string' can't be used to index type?
- Global window object: Element implicitly has an 'any' type because index expression is not of type 'number'.ts
- TypeScript - Element implicitly has an 'any' type because expression of type '"storyFile"' can't be used to index type '{}'
- Typescript with React > Element implicitly has an 'any' type because expression of type 'string' can't be used to index
- Element implicitly has an 'any' type because expression of type 'any' can't be used to index type 'Item'
- Nested Object -> Element implicitly has an 'any' type because expression of type 'string' can't be used to index type
- Element implicitly has an 'any' type because expression of type 'any' can't be used to index type '{}' - React Anagram
- Element implicitly has an 'any' type because expression of type 'string | number' can't be used to index type
- Element implicitly has an 'any' type because expression of type 'number' can't be used to index type 'Number'
- Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'
- Element implicitly has an 'any' type because expression of type 'number' can't be used to index type '{}'
- Element implicitly has an 'any' type because expression of type 'any' can't be used to index type with createStyles
- Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'BGColors'
- binding element 'yyy' implicitly has an 'any' type error in typescript
- TypeScript Err: "Element implicitly has an 'any' type because expression of type 'any' can't be used to index type
- Typescript-React State: Element implicitly has an 'any' type because type 'State' has no index signature
- React Typescript: Element implicitly has an 'any' type because type has no index signature
More Query from same tag
- Cannot read property 'call' of undefined Webpack Bootstrap React
- how to pass the current item to the function so that i can remove it from array in react component?
- Downloading and saving data with fetch() from authenticated REST
- How do I draw a half circle outline SVG and fill it in with Javascript given a range of data?
- How to add page transitions to React without using the router?
- How to filter dates with a given range from a start and end date?
- How to notify offline Firebase Cloud Messaging web-clients that they have unread messages
- How to create and run a development build of an application using create-react-app configuration
- Props is a deprecated symbol in React with Typescript
- Axios only called once inside self-invoking function (Internet Explorer)
- Setting react state the right way
- My form is not updating when its. preloaded with default value - react
- how to make a recursive function asynchronous
- How can I disable underline in Material-UI without removing the selection in Autocomplete?
- TypeError: Cannot read property 'map' of null, REACTJS and Axios
- Expo XDE cannot run application throws Tunnel packager not found
- Delete request in React
- React JS : Check Email Id is valid or not along with comma separated email id
- useEffect does not trigger after store update
- Antdesign: Call a function when you click on a Modal button in React
- How to convert recieved string to enum
- how to map object into array of objects for selectsearch in react?
- Sending emails using next.js API after creating a user ERR_HTTP_HEADERS_SENT
- Reactjs siblings class toggle
- Material ui InputBase can not be hided by other elements
- Correct way to React axios post with UUID and nested object in JSON payload?
- Getting checkbox value in react onchek
- React-Final-Form csv upload submit
- Gatsbyjs image with Webp and fallback to jpg using picture tag not working
- Extracting styles from material ui component