Some JS snippet fixes.
Added TypeScript support.