Based on the DefinitelyTyped definitions with a different approach to enums and some bug fixes.