fix(core): Update types for TypeScript nullability support (#15472)

This commit is contained in:
Miško Hevery
2017-03-29 09:34:45 -07:00
committed by Victor Berchet
parent 331b9f6425
commit 910c0d9ee7
84 changed files with 1287 additions and 1260 deletions

View File

@ -40,7 +40,7 @@ export function init(moduleRef: NgModuleRef<AppModule>) {
const injector = moduleRef.injector;
appRef = injector.get(ApplicationRef);
const numberOfChecksEl = document.getElementById('numberOfChecks');
const numberOfChecksEl = document.getElementById('numberOfChecks') !;
tree = appRef.components[0].instance;

View File

@ -13,10 +13,10 @@ export class TreeNode {
children: TreeNode[];
constructor(
public value: string, public depth: number, public maxDepth: number, public left: TreeNode,
public right: TreeNode) {
public value: string, public depth: number, public maxDepth: number,
public left: TreeNode|null, public right: TreeNode|null) {
this.transitiveChildCount = Math.pow(2, (this.maxDepth - this.depth + 1)) - 1;
this.children = this.left ? [this.left, this.right] : [];
this.children = this.left ? [this.left, this.right !] : [];
}
// Needed for Polymer as it does not support ternary nor modulo operator

View File

@ -35,7 +35,7 @@ export function getStringParameter(name: string) {
}
export function bindAction(selector: string, callback: () => void) {
document.querySelector(selector).addEventListener('click', callback);
document.querySelector(selector) !.addEventListener('click', callback);
}
@ -60,7 +60,7 @@ export function profile(create: () => void, destroy: () => void, name: string) {
function urlParamsToForm() {
const regex = /(\w+)=(\w+)/g;
const search = decodeURIComponent(location.search);
let match: any[];
let match: any[]|null;
while (match = regex.exec(search)) {
const name = match[1];
const value = match[2];
@ -75,4 +75,4 @@ function urlParamsToForm() {
}
}
}
}
}