4 ms·
One thing that threw me off initially is the fact that typescript will complain about errors, but still do the translation of TS -> JS. For example: var s
by rictic 13y ago
One thing that threw me off initially is the fact that typescript will complain about errors, but still do the translation of TS -> JS. For example:
var s = 'hello';
s.toExponential();
Typescript tells you about the obvious error that there's no property 'toExponential' on strings, but it also merrily produces yourfilename.js.
In my experience so long as you don't have any syntax errors, tsc will give you back javascript. This is partly because the translation from typescript to javascript is incredibly straightforwards and ignores the types completely. Writing a nonvalidating, dumb but super fast ts -> js transpiler is about an afternoon's worth of work, especially if you bootstrapped from the typescript parser and tests.