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

@ -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);