Typescript integration

The TypeScript compilation code looks similar (yes those 2 lines) in the 3 hooks. Consider extracting it in separate file that is executed in the 3 hooks. This will also enable you to introduce the hook for platform specific files in its own file as well.