From ff5b02248a6a0342fab6848a0e579c2860d39b6a Mon Sep 17 00:00:00 2001 From: Jesus Rodriguez Date: Mon, 21 Nov 2016 00:39:17 +0100 Subject: [PATCH] chore: use tsconfig lib --- package.json | 7 +----- .../docs/_examples/_boilerplate/package.json | 7 +----- .../docs/_examples/_boilerplate/tsconfig.json | 2 +- .../cb-aot-compiler/ts/tsconfig-aot.json | 2 +- public/docs/_examples/package.json | 10 ++------ .../_examples/quickstart/js/package.1.json | 7 +----- .../_examples/quickstart/ts/package.1.json | 7 +----- .../_examples/quickstart/ts/tsconfig.1.json | 2 +- .../docs/_examples/styleguide/package.1.json | 7 +----- .../docs/_examples/toh-6/ts/tsconfig-aot.json | 2 +- public/docs/_examples/tsconfig.json | 2 +- .../ts/package.ng1.json | 7 +----- .../_examples/webpack/ts/package.webpack.json | 8 +------ .../guide/typescript-configuration.jade | 23 ++++++++++++++----- 14 files changed, 31 insertions(+), 62 deletions(-) diff --git a/package.json b/package.json index 955de60cd4..a7a26c17d3 100644 --- a/package.json +++ b/package.json @@ -15,12 +15,7 @@ "type": "git", "url": "https://github.com/angular/angular.io.git" }, - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/angular/angular.io/blob/master/LICENSE" - } - ], + "license": "MIT", "bugs": { "url": "" }, diff --git a/public/docs/_examples/_boilerplate/package.json b/public/docs/_examples/_boilerplate/package.json index bcccdd978a..320fa8f6b2 100644 --- a/public/docs/_examples/_boilerplate/package.json +++ b/public/docs/_examples/_boilerplate/package.json @@ -24,12 +24,7 @@ }, "keywords": [], "author": "", - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/angular/angular.io/blob/master/LICENSE" - } - ], + "license": "MIT", "dependencies": {}, "devDependencies": {}, "repository": {} diff --git a/public/docs/_examples/_boilerplate/tsconfig.json b/public/docs/_examples/_boilerplate/tsconfig.json index d90e457b10..2ec4cc8806 100644 --- a/public/docs/_examples/_boilerplate/tsconfig.json +++ b/public/docs/_examples/_boilerplate/tsconfig.json @@ -6,7 +6,7 @@ "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, - "removeComments": false, + "lib": ["es2015", "dom"], "noImplicitAny": true, "suppressImplicitAnyIndexErrors": true, "typeRoots": [ diff --git a/public/docs/_examples/cb-aot-compiler/ts/tsconfig-aot.json b/public/docs/_examples/cb-aot-compiler/ts/tsconfig-aot.json index 2a8ebdf309..58aaaf181b 100644 --- a/public/docs/_examples/cb-aot-compiler/ts/tsconfig-aot.json +++ b/public/docs/_examples/cb-aot-compiler/ts/tsconfig-aot.json @@ -6,7 +6,7 @@ "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, - "removeComments": false, + "lib": ["es2015", "dom"], "noImplicitAny": true, "suppressImplicitAnyIndexErrors": true }, diff --git a/public/docs/_examples/package.json b/public/docs/_examples/package.json index 160fa06771..38f75c300f 100644 --- a/public/docs/_examples/package.json +++ b/public/docs/_examples/package.json @@ -8,12 +8,7 @@ }, "keywords": [], "author": "", - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/angular/angular.io/blob/master/LICENSE" - } - ], + "license": "MIT", "dependencies": { "@angular/common": "~2.2.0", "@angular/compiler": "~2.2.0", @@ -27,7 +22,7 @@ "@angular/router": "~3.2.0", "@angular/upgrade": "~2.2.0", - "angular-in-memory-web-api": "~0.1.15", + "angular-in-memory-web-api": "~0.1.16", "core-js": "^2.4.1", "reflect-metadata": "^0.1.8", @@ -46,7 +41,6 @@ "@types/angular-resource": "^1.5.6", "@types/angular-route": "^1.3.2", "@types/angular-sanitize": "^1.3.3", - "@types/core-js": "^0.9.34", "@types/jasmine": "~2.5.36", "@types/node": "^6.0.45", "@types/selenium-webdriver": "^2.53.32", diff --git a/public/docs/_examples/quickstart/js/package.1.json b/public/docs/_examples/quickstart/js/package.1.json index 497c673b7f..b2806609af 100644 --- a/public/docs/_examples/quickstart/js/package.1.json +++ b/public/docs/_examples/quickstart/js/package.1.json @@ -5,12 +5,7 @@ "start": "npm run lite", "lite": "lite-server" }, - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/angular/angular.io/blob/master/LICENSE" - } - ], + "license": "MIT", "dependencies": { "@angular/common": "~2.2.0", "@angular/compiler": "~2.2.0", diff --git a/public/docs/_examples/quickstart/ts/package.1.json b/public/docs/_examples/quickstart/ts/package.1.json index 3236914309..25a2c5ec9a 100644 --- a/public/docs/_examples/quickstart/ts/package.1.json +++ b/public/docs/_examples/quickstart/ts/package.1.json @@ -7,12 +7,7 @@ "tsc": "tsc", "tsc:w": "tsc -w" }, - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/angular/angular.io/blob/master/LICENSE" - } - ], + "license": "MIT", "dependencies": { "@angular/common": "~2.2.0", "@angular/compiler": "~2.2.0", diff --git a/public/docs/_examples/quickstart/ts/tsconfig.1.json b/public/docs/_examples/quickstart/ts/tsconfig.1.json index e6a6eac11d..fdb405465d 100644 --- a/public/docs/_examples/quickstart/ts/tsconfig.1.json +++ b/public/docs/_examples/quickstart/ts/tsconfig.1.json @@ -6,7 +6,7 @@ "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, - "removeComments": false, + "lib": ["es2015", "dom"], "noImplicitAny": false } } diff --git a/public/docs/_examples/styleguide/package.1.json b/public/docs/_examples/styleguide/package.1.json index 2aafb8b80a..732f6bf8fd 100644 --- a/public/docs/_examples/styleguide/package.1.json +++ b/public/docs/_examples/styleguide/package.1.json @@ -7,12 +7,7 @@ "lite": "lite-server", "start": "concurrently \"npm run tsc:w\" \"npm run lite\" " }, - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/angular/angular.io/blob/master/LICENSE" - } - ], + "license": "MIT", "dependencies": { "angular2": "2.0.0-beta.0", "systemjs": "0.19.6", diff --git a/public/docs/_examples/toh-6/ts/tsconfig-aot.json b/public/docs/_examples/toh-6/ts/tsconfig-aot.json index 97d6f592a0..e8bf8c3aee 100644 --- a/public/docs/_examples/toh-6/ts/tsconfig-aot.json +++ b/public/docs/_examples/toh-6/ts/tsconfig-aot.json @@ -6,7 +6,7 @@ "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, - "removeComments": false, + "lib": ["es2015", "dom"], "noImplicitAny": true, "suppressImplicitAnyIndexErrors": true, "typeRoots": [ diff --git a/public/docs/_examples/tsconfig.json b/public/docs/_examples/tsconfig.json index ba08b1131d..41a6efb13d 100644 --- a/public/docs/_examples/tsconfig.json +++ b/public/docs/_examples/tsconfig.json @@ -8,7 +8,7 @@ "sourceMap": true, "emitDecoratorMetadata": true, "experimentalDecorators": true, - "removeComments": false, + "lib": ["es2015", "dom"], "noImplicitAny": true, "suppressImplicitAnyIndexErrors": true, "typeRoots": [ diff --git a/public/docs/_examples/upgrade-phonecat-2-hybrid/ts/package.ng1.json b/public/docs/_examples/upgrade-phonecat-2-hybrid/ts/package.ng1.json index 9c7e5dd2d0..54f73776dd 100644 --- a/public/docs/_examples/upgrade-phonecat-2-hybrid/ts/package.ng1.json +++ b/public/docs/_examples/upgrade-phonecat-2-hybrid/ts/package.ng1.json @@ -4,12 +4,7 @@ "version": "0.0.0", "description": "A tutorial application for AngularJS", "repository": "https://github.com/angular/angular-phonecat", - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/angular/angular.io/blob/master/LICENSE" - } - ], + "license": "MIT", "devDependencies": { "bower": "^1.7.7", "http-server": "^0.9.0", diff --git a/public/docs/_examples/webpack/ts/package.webpack.json b/public/docs/_examples/webpack/ts/package.webpack.json index 553ca9338a..8a19341afe 100644 --- a/public/docs/_examples/webpack/ts/package.webpack.json +++ b/public/docs/_examples/webpack/ts/package.webpack.json @@ -7,12 +7,7 @@ "test": "karma start", "build": "rimraf dist && webpack --config config/webpack.prod.js --progress --profile --bail" }, - "licenses": [ - { - "type": "MIT", - "url": "https://github.com/angular/angular.io/blob/master/LICENSE" - } - ], + "license": "MIT", "dependencies": { "@angular/common": "~2.2.0", "@angular/compiler": "~2.2.0", @@ -27,7 +22,6 @@ "zone.js": "^0.6.25" }, "devDependencies": { - "@types/core-js": "^0.9.34", "@types/node": "^6.0.45", "@types/jasmine": "^2.5.35", "angular2-template-loader": "^0.4.0", diff --git a/public/docs/ts/latest/guide/typescript-configuration.jade b/public/docs/ts/latest/guide/typescript-configuration.jade index 27fce90b14..4540d6d396 100644 --- a/public/docs/ts/latest/guide/typescript-configuration.jade +++ b/public/docs/ts/latest/guide/typescript-configuration.jade @@ -73,7 +73,21 @@ a(id="typings") The `node_modules/@angular/core/` folder of any Angular application contains several `d.ts` files that describe parts of Angular. **You need do nothing to get *typings* files for library packages that include `d.ts` files—as all Angular packages do.** - + + ### lib.d.ts + + TypeScript includes a special declaration file called `lib.d.ts`. This file contains the ambient declarations for various common JavaScript constructs present in JavaScript runtimes and the DOM. + + Based on the `--target`, TypeScript adds _additional_ ambient declarations like `Promise` if our target is `es6`. + + Since the QuickStart is targeting `es5`, we can override the list of declaration files to be included: + +code-example(format=".") + "lib": ["es2015", "dom"] + +:marked + Thanks to that, we have all the `es6` typings even when targeting `es5`. + ### Installable typings files Many libraries—jQuery, Jasmine, and Lodash among them—do *not* include `d.ts` files in their npm packages. Fortunately, either their authors or community contributors have created separate `d.ts` files for these libraries and @@ -86,11 +100,8 @@ a(id="typings") For instance, to install typings for `jasmine` we could do `npm install @types/jasmine --save-dev`. :marked - QuickStart identified three *typings* (`d.ts`) files: - - * [core-js](https://github.com/zloirock/core-js/blob/master/README.md) - brings ES2015/ES6 capabilities to ES5 browsers - + QuickStart identified two *typings* (`d.ts`) files: + * [jasmine](http://jasmine.github.io/) typings for the Jasmine test framework * [node](https://www.npmjs.com/package/@types/node) for code that references objects in the *nodejs* environment;