fix documentation: return value of clazz/trait was wrong
fix coding style
first round of TypeScript definition revamp