Use a proper type with TypeScript enums

Fixes #149