Skip to content

Commit

Permalink
fix: Update types for TypeScript nullability support in examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mhevery authored and hansl committed Apr 12, 2017
1 parent 14669f2 commit 6f5fccf
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
6 changes: 3 additions & 3 deletions packages/examples/common/ngIf/ts/module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,13 +57,13 @@ class NgIfElse {
`
})
class NgIfThenElse implements OnInit {
thenBlock: TemplateRef<any> = null;
thenBlock: TemplateRef<any>|null = null;
show: boolean = true;

@ViewChild('primaryBlock')
primaryBlock: TemplateRef<any> = null;
primaryBlock: TemplateRef<any>|null = null;
@ViewChild('secondaryBlock')
secondaryBlock: TemplateRef<any> = null;
secondaryBlock: TemplateRef<any>|null = null;

switchPrimary() {
this.thenBlock = this.thenBlock === this.primaryBlock ? this.secondaryBlock : this.primaryBlock;
Expand Down
6 changes: 3 additions & 3 deletions packages/examples/common/pipes/ts/async_pipe.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ import {Subscriber} from 'rxjs/Subscriber';
</div>`
})
export class AsyncPromisePipeComponent {
greeting: Promise<string> = null;
greeting: Promise<string>|null = null;
arrived: boolean = false;

private resolve: Function = null;
private resolve: Function|null = null;

constructor() { this.reset(); }

Expand All @@ -36,7 +36,7 @@ export class AsyncPromisePipeComponent {
if (this.arrived) {
this.reset();
} else {
this.resolve('hi there!');
this.resolve !('hi there!');
this.arrived = true;
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import {DebugElement} from '@angular/core';

let debugElement: DebugElement;
let debugElement: DebugElement = undefined !;
let predicate: any;

// #docregion scope_all
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/core/di/ts/metadata_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ export function main() {
declarations: [App, ParentCmp, ChildDirective],
});

let cmp: ComponentFixture<App>;
let cmp: ComponentFixture<App> = undefined !;
expect(() => cmp = TestBed.createComponent(App)).not.toThrow();

expect(cmp.debugElement.children[0].children[0].injector.get(ChildDirective).logs).toEqual([
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/platform-browser/dom/debug/ts/by/by.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import {DebugElement} from '@angular/core';
import {By} from '@angular/platform-browser';

let debugElement: DebugElement;
let debugElement: DebugElement = undefined !;
class MyDirective {}

// #docregion by_all
Expand Down
1 change: 1 addition & 0 deletions packages/examples/tsconfig-build.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
"stripInternal": true,
"experimentalDecorators": true,
"noImplicitAny": true,
"strictNullChecks": true,
"emitDecoratorMetadata": true,
"module": "commonjs",
"moduleResolution": "node",
Expand Down

0 comments on commit 6f5fccf

Please sign in to comment.