RecipesChapter 3: The Type System

Using Index Signatures

Recipe 3.9 from The TypeScript Cookbook

type StringDictionary = {
  [index: string]: string;
  count: number;
  // Error: Property 'count' of type 'number' is not assignable
  // to 'string' index type 'string'.(2411)
};
Open in TypeScript Playground →