How to make it possible to use Typescript with SystemJS and Angular?

前端 未结 3 1623
再見小時候
再見小時候 2021-01-12 00:44

I\'m trying to make SystemJS work with Typescript, but they seem to conflict with each other.

How can I take advantage of the autoloading from System.js without it

3条回答
  •  悲&欢浪女
    2021-01-12 01:25

    you can see here the way I did it with traceur instead of Typescript, but it should work pretty much the same with Typescript, I'll add ts as soon as I can play again with it.

    NOTE:Is more of self-reminder or a playground than a proper seed

    As Steve mentioned the strongest point of SystemJs is that you can use almost any module definition , the loader should detect the module format, I personally prefer to declare the modules as in

    define([deps...],(deps..){
        // ...
    })
    

    I find it to be like constructor injection pattern from other languages and frameworks and it always translates to the same Javascript, beacuse it is Javascript , beautified with class and arrow functions (+anotated with types the case Typescript).

    Also choosing amd shown clearly asynchronous intentions, that would be honor anyway if you choose lets say ES6 module syntax, beacuse the code after the import sentence will only executed when the dependencies have finished loading. pretty much like the async keyword it feels a little too cryptic for the non initiated

    BTW: and OutOFcontext: Cheers from SA / JHB to the amazing work of SystemJS dev Mr. Bedford

提交回复
热议问题