The main issue is that you're doing React.FC<[Props]> instead of React.FC<Props>. With the square brackets, you're creating a tuple type, whose's zeroth element is of type Props, and then you're having that tuple be the props of your component.

interface Props {
  propWhichIsArray: {
    id: ID; // I assume ID is defined elsewhere
    text: string;
  }[]
}

const Component: React.FC<Props> = ({ propWhichIsArray }) => {

If this data in the array is being used in other places, you may want to pull it out to its own interface:

interface Thingamajig {
  id: ID;
  text: string;
}

interface Props {
  propWhichIsArray: Thingamajig[];
}
Answer from Nicholas Tower on Stack Overflow
🌐
DhiWise
dhiwise.com › post › mastering-typescript-array-of-object-a-comprehensive-guide
TypeScript Array of Objects in React: Write Error-free Code
October 17, 2024 - This blog will guide you through the essentials of using TypeScript arrays and objects to handle intricate data with ease. Let's dive into the world of efficient data management with TypeScript in React!
Discussions

reactjs - React.Js - Typescript how to pass an array of Objects as props? - Stack Overflow
everyone. So I am learning TypeScript with React.Js and I have come to a problem. I have a "page" that has an array of objects that have further information about each user const USERS = ... More on stackoverflow.com
🌐 stackoverflow.com
How to pass an array as a prop in typescript react hooks
interface Props { report: ReportData[]; } First of all React.FC is not recommended anymore, just use a function that returns the specific type you want to return. Second props is always an object, so props: ReportData will always be wrong. Third, you’re storing your state an array of ReportData but you’ve told your component it’s a single instance of ReportData. Finally, you are going to be calling your API on every single render, this in turn will cause you to update your state on every render causing a delayed infinite loop or until your API returns an error. Look up useEffect. You should go and revisit TypeScript and React basics since there is quite a lot wrong here. More on reddit.com
🌐 r/reactjs
4
2
November 29, 2021
TypeScript + React.js -- how do you iterate over an array of objects with map() in order to render content?
useState(null); More on reddit.com
🌐 r/typescript
11
1
January 5, 2022
reactjs - React js Typescript string array variable - Stack Overflow
I have the following two components. I think I'm having trouble properly declaring my array object to match the interface I've declared. Why do I get the following error on all my properties? [0]... More on stackoverflow.com
🌐 stackoverflow.com
People also ask

What is the syntax for an array of objects in TypeScript?
The syntax for an array of objects in TypeScript involves using either an interface or an inline type declaration. For example: ```typescript let people: { name: string; age: number }[] = [ { name: "John", age: 30 }, { name: "Jane", age: 25 }, ]; ``` This ensures that each object in the array has the specified properties and types.
🌐
dhiwise.com
dhiwise.com › post › mastering-typescript-array-of-object-a-comprehensive-guide
TypeScript Array of Objects in React: Write Error-free Code
How do you push an object into a TypeScript array?
You can use the `push()` method to add an object to a TypeScript array. The object must match the type of the array's elements. For example: ```typescript people.push({ name: "Doe", age: 35 }); ``` This method adds the object to the end of the array and ensures type safety.
🌐
dhiwise.com
dhiwise.com › post › mastering-typescript-array-of-object-a-comprehensive-guide
TypeScript Array of Objects in React: Write Error-free Code
What is the best way to define an array of objects in TypeScript?
The best way to define an array of objects in TypeScript is by using interfaces to create structured object types. Then, you can declare an array using the interface. This approach ensures that each object in the array adheres to the defined structure, preventing errors during development.
🌐
dhiwise.com
dhiwise.com › post › mastering-typescript-array-of-object-a-comprehensive-guide
TypeScript Array of Objects in React: Write Error-free Code
Top answer
1 of 11
643

You are better off using a native array instead of an object literal with number-like properties, so that numbering (as well as numerous other array functions) are taken care of off-the-shelf.

What you are looking for here is an inline interface definition for your array that defines every element in that array, whether initially present or introduced later:

let userTestStatus: { id: number, name: string }[] = [
    { "id": 0, "name": "Available" },
    { "id": 1, "name": "Ready" },
    { "id": 2, "name": "Started" }
];

userTestStatus[34978].nammme; // Error: Property 'nammme' does not exist on type [...]

If you are initializing your array with values right away, the explicit type definition is not a necessity; TypeScript can automatically infer most element types from the initial assignment:

let userTestStatus = [
    { "id": 0, "name": "Available" },
    ...
];

userTestStatus[34978].nammme; // Error: Property 'nammme' does not exist on type [...]
2 of 11
159

What you have above is an object, not an array.

To make an array use [ & ] to surround your objects.

userTestStatus = [
  { "id": 0, "name": "Available" },
  { "id": 1, "name": "Ready" },
  { "id": 2, "name": "Started" }
];

Aside from that TypeScript is a superset of JavaScript so whatever is valid JavaScript will be valid TypeScript so no other changes are needed.

Feedback clarification from OP... in need of a definition for the model posted

You can use the types defined here to represent your object model:

type MyType = {
    id: number;
    name: string;
}

type MyGroupType = {
    [key:string]: MyType;
}

var obj: MyGroupType = {
    "0": { "id": 0, "name": "Available" },
    "1": { "id": 1, "name": "Ready" },
    "2": { "id": 2, "name": "Started" }
};
// or if you make it an array
var arr: MyType[] = [
    { "id": 0, "name": "Available" },
    { "id": 1, "name": "Ready" },
    { "id": 2, "name": "Started" }
];
🌐
Bobby Hadz
bobbyhadz.com › blog › react-typescript-usestate-array-of-objects
Type useState as Array or Object in React TypeScript | bobbyhadz
TypeScript was able to infer the type based on the provided initial value. However, it is a best practice to always explicitly type the useState hook, especially when working with arrays and objects. If we try to add a value of a different type to the state array, we would get a type checking error. ... Copied!import React from 'react'; import {useState} from 'react'; const App = () => { // 👇️ const names: string[] const [names, setNames] = useState<string[]>([]); // ⛔️ Argument of type '(prevNames: string[]) => (string | number)[]' is not // assignable to parameter of type 'SetStateA
🌐
Medium
medium.com › @jayashakthiperera › mastering-typescript-array-functions-in-react-a8d6dda94cbf
Mastering TypeScript Array Functions in React | by Jayashakthi Perera | Medium
November 7, 2023 - It's also a good choice when you want to keep your operations free of side effects and contained within the scope of a single function. ... To wrap up, using map(), forEach(), and reduce() correctly makes a big difference in React apps with TypeScript. Remember, map() is for creating new arrays, forEach() is for doing something with each item, and reduce() is for turning an array into one thing, like a sum or object.
Find elsewhere
🌐
Educative
educative.io › home › courses › using typescript with react › creating a strongly-typed array
Creating a strongly-typed array - Using TypeScript with React
Learn how to create strongly typed arrays in TypeScript using generic types, square bracket notation, and type inference for React development.
🌐
TypeScript
typescriptlang.org › docs › handbook › 2 › objects.html
TypeScript: Documentation - Object Types
Generic object types are often some sort of container type that work independently of the type of elements they contain. It’s ideal for data structures to work this way so that they’re re-usable across different data types. It turns out we’ve been working with a type just like that throughout this handbook: the Array type.
🌐
Educative
educative.io › home › courses › using typescript with react › creating a strongly-typed array
Creating Strongly Typed Arrays in TypeScript for React
Learn how to create strongly typed arrays in TypeScript using generic types, square bracket notation, and type inference for React development.
🌐
Tim Mousk
timmousk.com › blog › typescript-array-of-objects
How To Define An Array Of Objects In TypeScript? – Tim Mouskhelichvili
March 6, 2023 - As you can see, it is easy to create an array of objects in TypeScript. We have four different ways of achieving it. Which one you choose is a question of preference. Here are some other TypeScript tutorials for you to enjoy: ... Hello! I am Tim Mouskhelichvili, a Freelance Developer & Consultant from Montreal, Canada. I specialize in React...
🌐
Medium
zainsadaqat.medium.com › create-usestate-hook-with-typescript-for-an-array-of-objects-2fe9b98a0df1
Create useState Hook with TypeScript for an Array of Objects | by Zain Sadaqat | Medium
May 5, 2024 - Create useState Hook with TypeScript for an Array of Objects Creating a state with a useState hook for an array of objects is one of the most commonly used use cases working in ReactJS. import React …
🌐
Reddit
reddit.com › r/reactjs › how to pass an array as a prop in typescript react hooks
r/reactjs on Reddit: How to pass an array as a prop in typescript react hooks
November 29, 2021 -

I have difficulty passing an array as a prop to a component from the parent in react typescript.

The error I am getting is

Type '{ report:ReportData[]; }' is not assignable to type 'IntrinsicAttributes & ReportData & { children?: ReactNode; }'.
Property 'report' does not exist on type 'IntrinsicAttributes & ReportData & { children?: ReactNode; }'. Did you mean 'Port'?

import ReportComponent from '../Components/Reports/ReportComponent';
import { ReportData } from "../Types/ReportData.types";
const Report = () => {
 const [Report, setReport] = useState<ReportData[]>([]);
 ReportService.GetReport()
      .then((response) => {
        console.log(response.data.data);
        setReport(response.data.data);
        toast.success(response.data.message);
      }).catch((e) => {
        console.log(e);
      });

  return <ReportComponent report={Report}/>;

//ReportComponent

const ReportComponent: React.FC<ReportData> = (props:ReportData) => {
console.log("props",props)
return  <div className="row">
          
        </div>
}

I will appreciate help on fixing this

Thanks

🌐
Reddit
reddit.com › r/typescript › typescript + react.js -- how do you iterate over an array of objects with map() in order to render content?
r/typescript on Reddit: TypeScript + React.js -- how do you iterate over an array of objects with map() in order to render content?
January 5, 2022 -

Hi, I have not been able to get any sort of clarity on this. Maybe someone here can help.

So, I need to fetch an API and return a list of products in a store, and then render that out to the user. In regular React this is easy, but I started learning TypeScript and it is throwing me for a loop.

I have the following interfaces + useState:

interface ProductInterface {
    id: string;
    fields: {
        company: string;
        featured: boolean;
        name: string;
        price: number;
    }
}
interface ProductsArrayInterface {
    products: ProductInterface[];
}
const [products, setProducts] = useState<ProductsArrayInterface|null>(null);

After calling the API I do setProducts(products) and then try to render it like so:

{products && products.map((product:any) => {
    const {id, fields} = product;
    return (
        <article key={id}>
            <h4>{fields.name}</h4>
            <h5>${fields.price/100}</h5>
        </article>
        )
    })
}

However, the error I get is "Property 'map' does not exist on type 'ProductsArrayInterface'". I tried using products.products.map() instead, and while that quieted the compiler errors, on run time the page doesn't load and it gives the "cannot read properties of undefined (reading 'map')" error in the console. So I am not sure what to do. What should I be doing here to render the array of objects?

🌐
Webdevtutor
webdevtutor.net › blog › typescript-react-array-of-objects
Mastering TypeScript in React: Working with Arrays of Objects
When iterating over an array of objects in React, TypeScript helps ensure that we access object properties safely.
🌐
TypeScript
typescriptlang.org › play › javascript › javascript-essentials › objects-and-arrays.ts.html
TypeScript: Playground Example - Objects and Arrays
type PurchaseOrder = typeof purchaseOrder; // Creates a readonly array of purchase orders const readonlyOrders: readonly PurchaseOrder[] = [purchaseOrder]; // Yep! That's a bit more code for sure. There's four new things here: type PurchaseOrder - Declares a new type to TypeScript. typeof - Use the type inference system to set the type based on the const which is passed in next. purchaseOrder - Get the variable purchaseOrder and tell TypeScript this is the shape of all objects in the orders array.
🌐
GeeksforGeeks
geeksforgeeks.org › typescript › how-can-i-define-an-array-of-objects-in-typescript
How can I Define an Array of Objects in TypeScript? - GeeksforGeeks
May 20, 2024 - In TypeScript, the way of defining the arrays of objects is different from JavaScript. Because we need to explicitly type the array at the time of declaration that it will be an Array of objects.
🌐
Bobby Hadz
bobbyhadz.com › blog › typescript-declare-array-of-objects
How to declare an Array of Objects in TypeScript | bobbyhadz
Even though we didn't explicitly type the arr variable, TypeScript already knows that it's an array of objects where each object has a name property of type string and an age property of type number.
🌐
DEV Community
dev.to › thelogicwarlock › using-typescript-with-react-the-syntax-4k3b
Using TypeScript with React, the Syntax - DEV Community
February 21, 2025 - We get to declare a type that goes ... or object. let color: string = "blue" color = 42 // This will not compile · TypeScript supports JavaScript out of the box because it's a superset of JavaScript, meaning that it compiles to JavaScript. Declaring types is super easy and doesn't require as much effort as you'd think. Here's an example of the general syntax used. ... You can use any JavaScript primitive type, along with some new ones. ... Arrays can be a little ...