feat: add support for TypeScript 3.1 (#26151)

PR Close #26151
This commit is contained in:
Igor Minar 2018-09-27 16:47:19 -07:00 committed by Alex Rickabaugh
parent f455518d80
commit 9993c72335
22 changed files with 34 additions and 136 deletions

View File

@ -1,24 +0,0 @@
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",
"outDir": "../../dist/typings_test_ts27/",
"rootDir": ".",
"target": "es5",
"lib": [
"es5",
"dom",
"es2015.collection",
"es2015.iterable",
"es2015.promise"
],
"types": [],
"strictNullChecks": true
},
"files": [
"include-all.ts",
"node_modules/@types/jasmine/index.d.ts"
]
}

View File

@ -1,49 +0,0 @@
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
import * as compiler from '@angular/compiler';
import * as compilerTesting from '@angular/compiler/testing';
import * as core from '@angular/core';
import * as coreTesting from '@angular/core/testing';
import * as elements from '@angular/elements';
import * as forms from '@angular/forms';
import * as http from '@angular/http';
import * as httpTesting from '@angular/http/testing';
import * as platformBrowser from '@angular/platform-browser';
import * as platformBrowserTesting from '@angular/platform-browser/testing';
import * as platformBrowserDynamic from '@angular/platform-browser-dynamic';
import * as platformServer from '@angular/platform-server';
import * as platformServerTesting from '@angular/platform-server/testing';
import * as platformWebworker from '@angular/platform-webworker';
import * as platformWebworkerDynamic from '@angular/platform-webworker-dynamic';
import * as router from '@angular/router';
import * as routerTesting from '@angular/router/testing';
import * as serviceWorker from '@angular/service-worker';
import * as upgrade from '@angular/upgrade';
export default {
compiler,
compilerTesting,
core,
coreTesting,
elements,
forms,
http,
httpTesting,
platformBrowser,
platformBrowserTesting,
platformBrowserDynamic,
platformServer,
platformServerTesting,
platformWebworker,
platformWebworkerDynamic,
router,
routerTesting,
serviceWorker,
upgrade,
};

View File

@ -1,31 +0,0 @@
{
"name": "angular-integration",
"description": "Assert that users with TypeScript 2.8 can type-check an Angular application",
"version": "0.0.0",
"license": "MIT",
"dependencies": {
"@angular/animations": "file:../../dist/packages-dist/animations",
"@angular/common": "file:../../dist/packages-dist/common",
"@angular/compiler": "file:../../dist/packages-dist/compiler",
"@angular/compiler-cli": "file:../../dist/packages-dist/compiler-cli",
"@angular/core": "file:../../dist/packages-dist/core",
"@angular/elements": "file:../../dist/packages-dist/elements",
"@angular/forms": "file:../../dist/packages-dist/forms",
"@angular/http": "file:../../dist/packages-dist/http",
"@angular/platform-browser": "file:../../dist/packages-dist/platform-browser",
"@angular/platform-browser-dynamic": "file:../../dist/packages-dist/platform-browser-dynamic",
"@angular/platform-server": "file:../../dist/packages-dist/platform-server",
"@angular/platform-webworker": "file:../../dist/packages-dist/platform-webworker",
"@angular/platform-webworker-dynamic": "file:../../dist/packages-dist/platform-webworker-dynamic",
"@angular/router": "file:../../dist/packages-dist/router",
"@angular/service-worker": "file:../../dist/packages-dist/service-worker",
"@angular/upgrade": "file:../../dist/packages-dist/upgrade",
"@types/jasmine": "2.5.41",
"rxjs": "file:../../node_modules/rxjs",
"typescript": "2.8.x",
"zone.js": "file:../../node_modules/zone.js"
},
"scripts": {
"test": "tsc"
}
}

View File

@ -1,6 +1,6 @@
{
"name": "angular-integration",
"description": "Assert that users with TypeScript 2.7 can type-check an Angular application",
"description": "Assert that users with TypeScript 3.0 can type-check an Angular application",
"version": "0.0.0",
"license": "MIT",
"dependencies": {
@ -22,7 +22,7 @@
"@angular/upgrade": "file:../../dist/packages-dist/upgrade",
"@types/jasmine": "2.5.41",
"rxjs": "file:../../node_modules/rxjs",
"typescript": "2.7.x",
"typescript": "3.1.x",
"zone.js": "file:../../node_modules/zone.js"
},
"scripts": {

View File

@ -4,7 +4,7 @@
"experimentalDecorators": true,
"module": "commonjs",
"moduleResolution": "node",
"outDir": "../../dist/typings_test_ts28/",
"outDir": "../../dist/typings_test_ts30/",
"rootDir": ".",
"target": "es5",
"lib": [

View File

@ -127,7 +127,7 @@
"tslint": "5.7.0",
"tslint-eslint-rules": "4.1.1",
"tsutils": "2.20.0",
"typescript": "~3.0.1",
"typescript": "~3.1.1",
"uglify-es": "^3.3.9",
"universal-analytics": "0.4.15",
"vlq": "0.2.2",

View File

@ -11,7 +11,7 @@
},
"peerDependencies": {
"@angular/compiler-cli": "0.0.0-PLACEHOLDER",
"typescript": ">=3.0.1 <3.1"
"typescript": ">=3.1.1 <3.2"
},
"repository": {
"type": "git",

View File

@ -23,7 +23,7 @@
},
"peerDependencies": {
"@angular/compiler": "0.0.0-PLACEHOLDER",
"typescript": ">=3.0.1 <3.1"
"typescript": ">=3.1.1 <3.2"
},
"engines" : {
"node" : ">=8.0"

View File

@ -72,14 +72,14 @@ const defaultEmitCallback: TsEmitCallback =
* Minimum supported TypeScript version
* supported typescript version v, v >= MIN_TS_VERSION
*/
const MIN_TS_VERSION = '3.0.1';
const MIN_TS_VERSION = '3.1.1';
/**
* Supremum of supported TypeScript versions
* supported typescript version v, v < MAX_TS_VERSION
* MAX_TS_VERSION is not considered as a supported TypeScript version
*/
const MAX_TS_VERSION = '3.1.0';
const MAX_TS_VERSION = '3.2.0';
class AngularCompilerProgram implements Program {
private rootNames: string[];

View File

@ -151,7 +151,7 @@ export class InertBodyHelper {
el.removeAttribute(attrName);
}
}
let childNode = el.firstChild;
let childNode = el.firstChild as Node | null;
while (childNode) {
if (childNode.nodeType === Node.ELEMENT_NODE) this.stripCustomNsAttrs(childNode as Element);
childNode = childNode.nextSibling;

View File

@ -116,10 +116,12 @@ function ngBackPatch_node_modules_libB_module_LibAModule() {
export const AppModuleFactory: NgModuleFactory<AppModule>&{patchedDeps: boolean} = {
moduleType: AppModule,
patchedDeps: false,
create(parentInjector: Injector | null): NgModuleRef<AppModule>{
this.patchedDeps && ngBackPatch_node_modules_libB_module() && (this.patchedDeps = true);
return details_elided;}
patchedDeps: false, create(parentInjector: Injector | null): NgModuleRef<AppModule>{
if (!this.patchedDeps) {
ngBackPatch_node_modules_libB_module();
this.patchedDeps = true;
} return details_elided;
}
};
// BEGIN FILE: src/app.ngfactory.ts

View File

@ -165,7 +165,7 @@ export function createCustomElement<P>(
// Listen for events from the strategy and dispatch them as custom events
this.ngElementEventsSubscription = this.ngElementStrategy.events.subscribe(e => {
const customEvent = createCustomEvent(this.ownerDocument, e.name, e.value);
const customEvent = createCustomEvent(this.ownerDocument !, e.name, e.value);
this.dispatchEvent(customEvent);
});
}

View File

@ -74,8 +74,8 @@ export function createCustomEvent(doc: Document, name: string, detail: any): Cus
/**
* Check whether the input is an `Element`.
*/
export function isElement(node: Node): node is Element {
return node.nodeType === Node.ELEMENT_NODE;
export function isElement(node: Node | null): node is Element {
return !!node && node.nodeType === Node.ELEMENT_NODE;
}
/**

View File

@ -118,7 +118,7 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
get attrToPropMap(): any { return _attrToPropMap; }
contains(nodeA: any, nodeB: any): boolean { return nodeContains.call(nodeA, nodeB); }
querySelector(el: Element, selector: string): any { return el.querySelector(selector); }
querySelector(el: HTMLElement, selector: string): any { return el.querySelector(selector); }
querySelectorAll(el: any, selector: string): any[] { return el.querySelectorAll(selector); }
on(el: Node, evt: any, listener: any) { el.addEventListener(evt, listener, false); }
onAndCancel(el: Node, evt: any, listener: any): Function {
@ -276,7 +276,7 @@ export class BrowserDomAdapter extends GenericBrowserDomAdapter {
getAttribute(element: Element, attribute: string): string|null {
return element.getAttribute(attribute);
}
getAttributeNS(element: Element, ns: string, name: string): string {
getAttributeNS(element: Element, ns: string, name: string): string|null {
return element.getAttributeNS(ns, name);
}
setAttribute(element: Element, name: string, value: string) { element.setAttribute(name, value); }

View File

@ -119,7 +119,7 @@ export abstract class DomAdapter {
abstract hasAttribute(element: any, attribute: string): boolean;
abstract hasAttributeNS(element: any, ns: string, attribute: string): boolean;
abstract getAttribute(element: any, attribute: string): string|null;
abstract getAttributeNS(element: any, ns: string, attribute: string): string;
abstract getAttributeNS(element: any, ns: string, attribute: string): string|null;
abstract setAttribute(element: any, name: string, value: string): any;
abstract setAttributeNS(element: any, ns: string, name: string, value: string): any;
abstract removeAttribute(element: any, attribute: string): any;

View File

@ -135,7 +135,7 @@ export class DominoAdapter extends BrowserDomAdapter {
}
getBaseHref(doc: Document): string {
const base = this.querySelector(doc.documentElement, 'base');
const base = this.querySelector(doc.documentElement !, 'base');
let href = '';
if (base) {
href = this.getHref(base);

View File

@ -1497,8 +1497,8 @@ export interface HttpDownloadProgressEvent extends HttpProgressEvent {
export declare class HttpErrorResponse extends HttpResponseBase implements Error {
readonly error: any | null;
readonly message: string;
readonly name: string;
readonly ok: boolean;
readonly name = "HttpErrorResponse";
readonly ok = false;
constructor(init: {
error?: any;
headers?: HttpHeaders;

View File

@ -26,7 +26,7 @@ export declare const APP_ID: InjectionToken<string>;
export declare const APP_INITIALIZER: InjectionToken<(() => void)[]>;
export declare class ApplicationInitStatus {
readonly done: boolean;
readonly done = false;
readonly donePromise: Promise<any>;
constructor(appInits: (() => any)[]);
}
@ -624,7 +624,7 @@ export declare abstract class Query {
export declare class QueryList<T> {
readonly changes: Observable<any>;
readonly dirty: boolean;
readonly dirty = true;
readonly first: T;
readonly last: T;
readonly length: number;

View File

@ -11,7 +11,7 @@
"test": "test"
},
"peerDependencies": {
"typescript": "^3.0.1"
"typescript": "~3.1.1"
},
"dependencies": {
"chalk": "^2.3.1",
@ -24,7 +24,7 @@
"@types/node": "^10.9.2",
"chai": "^4.1.2",
"jasmine": "^3.1.0",
"typescript": "~3.0.1"
"typescript": "~3.1.1"
},
"repository": {},
"keywords": [

View File

@ -165,9 +165,9 @@ type-detect@^4.0.0:
version "4.0.8"
resolved "https://registry.yarnpkg.com/type-detect/-/type-detect-4.0.8.tgz#7646fb5f18871cfbb7749e69bd39a6388eb7450c"
typescript@~3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.0.1.tgz#43738f29585d3a87575520a4b93ab6026ef11fdb"
typescript@~3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.1.1.tgz#3362ba9dd1e482ebb2355b02dfe8bcd19a2c7c96"
wrappy@1:
version "1.0.2"

View File

@ -7151,9 +7151,9 @@ typedarray@^0.0.6:
version "2.7.2"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-2.7.2.tgz#2d615a1ef4aee4f574425cdff7026edf81919836"
typescript@~3.0.1:
version "3.0.1"
resolved "https://registry.yarnpkg.com/npm/OBG-NPM/typescript/-/typescript-3.0.1.tgz#43738f29585d3a87575520a4b93ab6026ef11fdb"
typescript@~3.1.1:
version "3.1.1"
resolved "https://registry.yarnpkg.com/typescript/-/typescript-3.1.1.tgz#3362ba9dd1e482ebb2355b02dfe8bcd19a2c7c96"
uglify-es@^3.3.9:
version "3.3.9"