> On 5 Mar 2019, at 20.15, Bob Pepin <[email protected]> wrote: > > On 5 Mar 2019, at 12.53, Bram Moolenaar <[email protected]> wrote: >> >> I wonder, is this also possible for Typescript? It's like a better >> version of Javascript, and its popularity is growing. > > How well this works in practice remains to be seen, I will try to play around > with it a bit. >
First results look promising, with the latest vim-duktape git and after downloading typescript.js from https://raw.githubusercontent.com/Microsoft/TypeScript/master/lib/typescript.js and putting it into a runtimepath directory: Entering Ex mode. Type "visual" to go to Normal mode. :duk var ts = require('typescript.js') :duk var source = 'for(const x of [1, 2, 3]) msg(x)' :duk var result = ts.transpileModule(source, {}) :duk JSON.stringify(result.outputText) Duktape result: "for (var _i = 0, _a = [1, 2, 3]; _i < _a.length; _i++) {\r\n var x = _a[_i];\r\n msg(x);\r\n}\r\n" :duk var fun = compile(result.outputText, "<inline>", {}) :duk fun() 1 2 3 Performance-wise, we are at 500 ms for require(’typescript.js’) and 9 ms for everything else. I will see if I can integrate the TypeScript module system with Vim sometime this week. Bob -- -- You received this message from the "vim_dev" maillist. Do not top-post! Type your reply below the text you are replying to. For more information, visit http://www.vim.org/maillist.php --- You received this message because you are subscribed to the Google Groups "vim_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
