Skip to content

Latest commit

 

History

History
21 lines (14 loc) · 517 Bytes

File metadata and controls

21 lines (14 loc) · 517 Bytes

typelab / aliases / ObjectEmpty

type ObjectEmpty = Record<PropertyKey, never>;

Extended TypeScript `Record` to define a empty object type.

Returns

Record type with PropertyKey as a key and never as a value

Example

// ObjEmpty is { [x: string]: never; [x: number]: never; [x: symbol]: never; }
type ObjEmpty = ObjectEmpty;

const Valid: ObjEmpty = {};
const Invalid: ObjEmpty = { a: 1 } // Type 'number' is not assignable to type 'never'