2 ms·
> Why wouldn't it? Whereas TypeScript/Babel/etc perform relatively simple source code transformations, you'd have to implement an entire JavaScript engine in W
by tlrobinson 11y ago
> Why wouldn't it?
Whereas TypeScript/Babel/etc perform relatively simple source code transformations, you'd have to implement an entire JavaScript engine in WebAssembly. It would almost certainly be slower and buggier than all of the big 4 JS engines.
> Check out the code it generates to support those annotations.
Ok, let's do that:
http://www.typescriptlang.org/Playground#src=interface%20Person%20%7B%0A%20%20%20%20firstname%3A%20string%3B%0A%20%20%20%20lastname%3A%20string%3B%0A%7D%0A%0Afunction%20greeter(person%20%3A%20Person)%20%7B%0A%20%20%20%20return%20%22Hello%2C%20%22%20%2B%20person.firstname%20%2B%20%22%20%22%20%2B%20person.lastname%3B%0A%7D%0A%0Avar%20user%20%3D%20%7Bfirstname%3A%20%22Jane%22%2C%20lastname%3A%20%22User%22%7D%3B%0A http://www.typescriptlang.org/Playground#src=interface%20Per...