Types now following Typescript definitions very closely.
Example updated with the latest typedefs.