-
Notifications
You must be signed in to change notification settings - Fork 122
TypeScript helper separation #178
Comments
@guybedford Currently we've made a few modifications in TypeScript (should be available in 1.6)
Is it enough for your scenarios or you would expect runtime library to be a module so in case if user writes some code that uses runtime helpers we would emit some code like System.register(["typescript-runtime"], function(exports_) {
var typescriptRuntime; // set in setter
var __extends = (this && this.__extends) || typescriptRuntime.__extends;
....
}) |
@vladima are you guys planning on shipping a file with all the global helpers? |
@vladima that sounds great. A runtime library module would definitely be nice to reference rather than relying on globals. Further than that, Babel has a transform option to output modular helpers: System.register(['helpers/core', 'helpers/class'], function(exports_) {
var __extends, __decorate;
return {
setters: [
function(core) { __extends = core.__extends; },
function(class) { __decorate = class.__decorate; }
],
};
}); etc. That said this now has the reverse problem that too much granular modularity actually becomes itself a performance bottleneck - something inbetween the Babel approach and a single runtime library might also be useful to split up just the needed helper modules as well (I guess only useful if the TypeScript runtime is very large to split it up?) |
we are considering this as an option but we need to figure out some questions about the format of helper: should it be just a set of globals or it should be a UMD module. If helper library is a module then it affect the codegen - we need to inject a runtime library in the list of modules |
@vladima the helper library can be treated just like any other library - distributed however the consumer desires - UMD / CommonJS / ES6. In terms of how we run TypeScript in this project, we would do a single file transpile and then set a custom path to the runtime library ( In terms of generating the helper library as part of a full tree build, then yes it would need to be injected for those cases using a standard format. |
Any news about how we could get a prelude containing the helpers required by our code to append it once to built files? Passing This is fragile. For instance, TS 1.8 has changed its code for We use gulp to build, it would be nice if TS could provide a file with just the helpers required by our code in its results. Babel does that for instance. Alternative: let us use babel for all transpiling by providing a new ESnext target, so that no TS helpers at all are required. |
Work on TypeScript use cases is happening through the plugin https://github.com/frankwallis/plugin-typescript, as this internal TypeScript transpilation will be deprecated in the next breaking release. |
@guybedford sorry, you can dismiss my comment. I got a notification from this issue (I subscribed to it) and added a comment assuming I was in the TS repo... Didn't pay attention to the fact this was systemjs! Too many subscriptions it seems, I get confused! |
Does TypeScript have a runtime-style module? Or are helpers concatenated per-build?
Currently the build is inlining all helpers, which is obviously not ideal.
The text was updated successfully, but these errors were encountered: