Convert AMD loader to TypeScript
Metadata housekeeping