TypeScript Object Type Index Signatures Last Updated : 28 Apr, 2025 Comments Improve Suggest changes Like Article Like Report In this article, we are going to learn about Object Type Index Signatures in Typescript. TypeScript is a popular programming language used for building scalable and robust applications. In TypeScript, index signatures allow you to define object types with dynamic keys, where the keys can be of a specific type, and the corresponding values can be of another type. This is particularly useful when you want to work with objects that have properties that are not known at compile-time but follow a specific pattern. Syntax: type MyObject = { [key: KeyType]: ValueType;};Where- MyObject is the name of the object type you are defining.KeyType is the type of key that can be used to access properties in the object.ValueType is the type of the values associated with the keys.Example 1: In this example, Dictionary is an object type with an index signature [word: string]: string. which means it can have keys of type string and values of type string. myDictionary is an instance of a Dictionary with three key-value pairs. You can access and modify values using dynamic keys within the specified type constraints. JavaScript type Dictionary = { [word: string]: string; }; const myDictionary: Dictionary = { "apple": "a fruit", "banana": "another fruit", "car": "a vehicle", }; // Outputs: "a fruit" console.log(myDictionary["apple"]); Output: Example 2: In this example, StudentGrades is an object type with an index signature [subject: string]: number;, which means it can have keys of type string (representing subjects) and values of type number (representing grades). grades is an instance of StudentGrades with three subject-grade pairs. JavaScript type StudentGrades = { [subject: string]: number; }; const grades: StudentGrades = { "Math": 90, "English": 85, "History": 78, }; // Outputs: 90 console.log(grades["Math"]); Output: Comment More infoAdvertise with us Next Article TypeScript Object Type Index Signatures A abhiisaxena09 Follow Improve Article Tags : JavaScript Web Technologies Geeks Premier League TypeScript Geeks Premier League 2023 +1 More Similar Reads TypeScript Object Tuple Types TypeScript provides various features to enhance type safety and developer productivity. One of these features includes Object Tuple Types. This feature ensures that an object follows a consistent shape in our code which results in a reduction in runtime errors and improves code quality. What are Obj 5 min read TypeScript Object The Array Type In TypeScript, the Array Type is used to specify and enforce the type of elements that can be stored in an array, enhancing type safety during development. This adaptability ensures reusability across diverse data types, as exemplified by the Array type (e.g., number[] or string[]). Syntaxlet myArra 2 min read TypeScript Generic Object Types TypeScript Generic Object Types allow you to create flexible and reusable type definitions for objects. These generic types can work with different shapes of objects while providing type safety, ensuring your code is both robust and adaptable. They are particularly useful for creating functions or c 3 min read TypeScript Object Types TypeScript object types define the structure of objects by specifying property types, ensuring type safety and clarity when passing objects as function parameters.Optional properties, denoted with a ? provide flexibility for objects with varying properties. This approach enhances code robustness by 3 min read TypeScript Object Type Property Modifiers TypeScript Type Property Modifiers are used to specify each property in an object such as: the type, whether the property is optional, and whether the property can be written to. TypeScript Object Type Property Modifiers:readonly Properties: An object type with readonly properties specifies that the 3 min read Like