object type

TypeScript did not have a type that represents the non-primitive type, i.e. any thing that is not numberstringbooleansymbolnullundefined. Enter the new object type.

With object type, APIs like Object.create can be better represented. For example:

  1. declare function create(o: object | null): void;
  2. create({ prop: 0 }); // OK
  3. create(null); // OK
  4. create(42); // Error
  5. create("string"); // Error
  6. create(false); // Error
  7. create(undefined); // Error