Skip to content

Instantly share code, notes, and snippets.

Created June 25, 2020 15:48
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
// This will list all the readonly properties of MyInterface
const readonlyProperties = propertiesOf<MyInterface>({ readonly: true });
// This will list all the optional properties of MyInterface
const optionalProperties = propertiesOf<MyInterface>({ optional: true });
// This will list all the required properties of MyInterface
const requiredProperties = propertiesOf<MyInterface>({ optional: false });
// But feel free to ask for private readonly OR public optional properties
const verySpecificProperties = propertiesOf<MyInterface>(
{ private: true, readonly: true }
{ public: true, optional: true }
// Or maybe a combination of required non-public properties
// and protected optional ones? I mean why not
const evenMoreSpecificProperties = propertiesOf<MyInterface>(
{ public: false, optional: false }
{ protected: true, optional: true }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment