typescript - Angular2: ES5'e derlerken birçok hata


tsconfig.json dosyasında angular 2 uygulamamı es5 olarak ayarladığımda derleyemiyorum. Bunu es6 olarak değiştirirsem tüm derleyici hatalarım kayboluyor.

tsconfig :

"compilerOptions": {
    "target": "es5",
    "module": "system",
    "declaration": false,
    "noImplicitAny": false,
    "removeComments": true,
    "noLib": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "sourceMap": true,
    "moduleResolution": "node"
  },
  "files": [ ... 

Index.html

<script src="~/node_modules/systemjs/dist/system.src.js"></script>
    <script src="~/node_modules/es6-shim/es6-shim.min.js"></script>
    <script src="~/node_modules/angular2/bundles/angular2-polyfills.js"></script>
    <script src="~/node_modules/moment/min/moment.min.js"></script>
    <script>
        System.config({
            defaultJSExtensions: true,
            baseURL: '/ECAV.Admin/node_modules',
            packages: {
                'app': { format: 'register', defaultExtension: 'js' },
                'rxjs': { defaultExtension: 'js' }
            },
            paths: {
                'angular2/*': 'angular2/*',
                'rxjs': 'rxjs/bundles/Rx.js',
                'linqsharp': 'linqsharp/built/linqsharp',
                'highcharts': 'highcharts',
                'ng2-highcharts': 'ng2-highcharts/ng2-highcharts',
                'lodash': 'lodash/lodash'             
            },
            map: {
                moment: 'moment/moment.js'
            }
        });
    </script>
    <script src="/Admin/node_modules/rxjs/bundles/Rx.js"></script>
    <script src="/Admin/node_modules/angular2/bundles/angular2.dev.js"></script>
    <script src="/Admin/node_modules/lodash/lodash.js"></script>

Örnek hata (kütüphane sınıflarından birçok tane var):

Build: Cannot find name 'Set'.  Admin   C:\dev\ecav\Admin\node_modules\angular2\src\common\directives\ng_class.d.ts 72  

Gereksinimlerimden biri bu web sitesini IE11'de çalıştırmak, bu yüzden ES5'e ihtiyacım var.

Her türlü yardım çok takdir edilir.

Cevap #1

ES5'e transpile ediyorsanız, ana TypeScript dosyanızda ///<reference path="node_modules/angular2/typings/browser.d.ts"/> ayarlamanız gerekebilir.

Kaynak: https://stackoverflow.com/a/35737470/3279156