fullstackBy Zahid

Difference b/w Interface and Record

Interface : when modeling real objects or entities that may be extended. eg: interface User { id: string; name: string; isActive: boolean; } // extendable interface Admin extends User { permissions: string[]; } Records : when creating a strict key-value mapping where keys come from a union type and all keys must be present. eg: type Status = "loading" | "success" | "error"; const statusText: Record = { loading: "Loading", success: "Done", error: "Failed", };
#typescript