diff --git a/packages/animations/browser/src/dsl/animation_timeline_builder.ts b/packages/animations/browser/src/dsl/animation_timeline_builder.ts index 534cf5c788..b9bc5b0920 100644 --- a/packages/animations/browser/src/dsl/animation_timeline_builder.ts +++ b/packages/animations/browser/src/dsl/animation_timeline_builder.ts @@ -586,7 +586,8 @@ export class AnimationTimelineContext { export class TimelineBuilder { public duration: number = 0; - public easing: string|null; + // TODO(issue/24571): remove '!'. + public easing !: string | null; private _previousKeyframe: ɵStyleData = {}; private _currentKeyframe: ɵStyleData = {}; private _keyframes = new Map(); diff --git a/packages/animations/browser/src/render/css_keyframes/css_keyframes_player.ts b/packages/animations/browser/src/render/css_keyframes/css_keyframes_player.ts index c6ff2f6fbc..8369201a36 100644 --- a/packages/animations/browser/src/render/css_keyframes/css_keyframes_player.ts +++ b/packages/animations/browser/src/render/css_keyframes/css_keyframes_player.ts @@ -23,9 +23,11 @@ export class CssKeyframesPlayer implements AnimationPlayer { private _onDestroyFns: Function[] = []; private _started = false; - private _styler: ElementAnimationStyleHandler; + // TODO(issue/24571): remove '!'. + private _styler !: ElementAnimationStyleHandler; - public parentPlayer: AnimationPlayer; + // TODO(issue/24571): remove '!'. + public parentPlayer !: AnimationPlayer; public readonly totalTime: number; public readonly easing: string; public currentSnapshot: {[key: string]: string} = {}; diff --git a/packages/animations/browser/src/render/transition_animation_engine.ts b/packages/animations/browser/src/render/transition_animation_engine.ts index 5c17d54c34..700c34b15e 100644 --- a/packages/animations/browser/src/render/transition_animation_engine.ts +++ b/packages/animations/browser/src/render/transition_animation_engine.ts @@ -1424,7 +1424,8 @@ export class TransitionAnimationPlayer implements AnimationPlayer { private _queuedCallbacks: {[name: string]: (() => any)[]} = {}; public readonly destroyed = false; - public parentPlayer: AnimationPlayer; + // TODO(issue/24571): remove '!'. + public parentPlayer !: AnimationPlayer; public markedForDestroy: boolean = false; public disabled = false; diff --git a/packages/animations/browser/src/render/web_animations/web_animations_player.ts b/packages/animations/browser/src/render/web_animations/web_animations_player.ts index 99fb96ee03..8db8088fe3 100644 --- a/packages/animations/browser/src/render/web_animations/web_animations_player.ts +++ b/packages/animations/browser/src/render/web_animations/web_animations_player.ts @@ -21,9 +21,11 @@ export class WebAnimationsPlayer implements AnimationPlayer { private _finished = false; private _started = false; private _destroyed = false; - private _finalKeyframe: {[key: string]: string | number}; + // TODO(issue/24571): remove '!'. + private _finalKeyframe !: {[key: string]: string | number}; - public readonly domPlayer: DOMAnimation; + // TODO(issue/24571): remove '!'. + public readonly domPlayer !: DOMAnimation; public time = 0; public parentPlayer: AnimationPlayer|null = null; diff --git a/packages/benchpress/src/firefox_extension/lib/main.ts b/packages/benchpress/src/firefox_extension/lib/main.ts index e66d549264..348014637c 100644 --- a/packages/benchpress/src/firefox_extension/lib/main.ts +++ b/packages/benchpress/src/firefox_extension/lib/main.ts @@ -12,8 +12,10 @@ const ParserUtil = require('./parser_util'); class Profiler { private _profiler: any; - private _markerEvents: any[]; - private _profilerStartTime: number; + // TODO(issue/24571): remove '!'. + private _markerEvents !: any[]; + // TODO(issue/24571): remove '!'. + private _profilerStartTime !: number; constructor() { this._profiler = Cc['@mozilla.org/tools/profiler;1'].getService(Ci.nsIProfiler); } diff --git a/packages/common/http/src/headers.ts b/packages/common/http/src/headers.ts index d6c5203510..a4c39e4f21 100755 --- a/packages/common/http/src/headers.ts +++ b/packages/common/http/src/headers.ts @@ -20,7 +20,8 @@ export class HttpHeaders { /** * Internal map of lowercase header names to values. */ - private headers: Map; + // TODO(issue/24571): remove '!'. + private headers !: Map; /** @@ -32,7 +33,8 @@ export class HttpHeaders { /** * Complete the lazy initialization of this object (needed before reading). */ - private lazyInit: HttpHeaders|Function|null; + // TODO(issue/24571): remove '!'. + private lazyInit !: HttpHeaders | Function | null; /** * Queued updates to be materialized the next initialization. diff --git a/packages/common/http/src/request.ts b/packages/common/http/src/request.ts index 6b920ed7d9..30413cb8da 100644 --- a/packages/common/http/src/request.ts +++ b/packages/common/http/src/request.ts @@ -88,7 +88,8 @@ export class HttpRequest { /** * Outgoing headers for this request. */ - readonly headers: HttpHeaders; + // TODO(issue/24571): remove '!'. + readonly headers !: HttpHeaders; /** * Whether this request should be made in a way that exposes progress events. @@ -119,7 +120,8 @@ export class HttpRequest { /** * Outgoing URL parameters. */ - readonly params: HttpParams; + // TODO(issue/24571): remove '!'. + readonly params !: HttpParams; /** * The outgoing URL with all URL parameters set. diff --git a/packages/common/http/src/response.ts b/packages/common/http/src/response.ts index bb6d292f3b..9a72499030 100644 --- a/packages/common/http/src/response.ts +++ b/packages/common/http/src/response.ts @@ -171,7 +171,8 @@ export abstract class HttpResponseBase { /** * Type of the response, narrowed to either the full response or the header. */ - readonly type: HttpEventType.Response|HttpEventType.ResponseHeader; + // TODO(issue/24571): remove '!'. + readonly type !: HttpEventType.Response | HttpEventType.ResponseHeader; /** * Super-constructor for all responses. diff --git a/packages/common/http/test/jsonp_mock.ts b/packages/common/http/test/jsonp_mock.ts index 2e7d58c0c0..7b2345d7c3 100644 --- a/packages/common/http/test/jsonp_mock.ts +++ b/packages/common/http/test/jsonp_mock.ts @@ -22,7 +22,8 @@ export class MockScriptElement { } export class MockDocument { - mock: MockScriptElement|null; + // TODO(issue/24571): remove '!'. + mock !: MockScriptElement | null; readonly body: any = this; createElement(tag: 'script'): HTMLScriptElement { diff --git a/packages/common/http/test/xhr_mock.ts b/packages/common/http/test/xhr_mock.ts index eceb729ebf..419d4af7e7 100644 --- a/packages/common/http/test/xhr_mock.ts +++ b/packages/common/http/test/xhr_mock.ts @@ -10,7 +10,8 @@ import {HttpHeaders} from '../src/headers'; import {XhrFactory} from '../src/xhr'; export class MockXhrFactory implements XhrFactory { - mock: MockXMLHttpRequest; + // TODO(issue/24571): remove '!'. + mock !: MockXMLHttpRequest; build(): XMLHttpRequest { return (this.mock = new MockXMLHttpRequest()) as any; } } @@ -30,8 +31,10 @@ export class MockXMLHttpRequestUpload { export class MockXMLHttpRequest { // Set by method calls. body: any; - method: string; - url: string; + // TODO(issue/24571): remove '!'. + method !: string; + // TODO(issue/24571): remove '!'. + url !: string; mockHeaders: {[key: string]: string} = {}; mockAborted: boolean = false; diff --git a/packages/common/src/directives/ng_class.ts b/packages/common/src/directives/ng_class.ts index ef832535ab..a8260a7f5d 100644 --- a/packages/common/src/directives/ng_class.ts +++ b/packages/common/src/directives/ng_class.ts @@ -38,10 +38,13 @@ import {Directive, DoCheck, ElementRef, Input, IterableChanges, IterableDiffer, */ @Directive({selector: '[ngClass]'}) export class NgClass implements DoCheck { - private _iterableDiffer: IterableDiffer|null; - private _keyValueDiffer: KeyValueDiffer|null; + // TODO(issue/24571): remove '!'. + private _iterableDiffer !: IterableDiffer| null; + // TODO(issue/24571): remove '!'. + private _keyValueDiffer !: KeyValueDiffer| null; private _initialClasses: string[] = []; - private _rawClass: string[]|Set|{[klass: string]: any}; + // TODO(issue/24571): remove '!'. + private _rawClass !: string[] | Set| {[klass: string]: any}; constructor( private _iterableDiffers: IterableDiffers, private _keyValueDiffers: KeyValueDiffers, diff --git a/packages/common/src/directives/ng_component_outlet.ts b/packages/common/src/directives/ng_component_outlet.ts index 3c018a7803..8048cafc95 100644 --- a/packages/common/src/directives/ng_component_outlet.ts +++ b/packages/common/src/directives/ng_component_outlet.ts @@ -66,10 +66,14 @@ import {ComponentFactoryResolver, ComponentRef, Directive, Injector, Input, NgMo */ @Directive({selector: '[ngComponentOutlet]'}) export class NgComponentOutlet implements OnChanges, OnDestroy { - @Input() ngComponentOutlet: Type; - @Input() ngComponentOutletInjector: Injector; - @Input() ngComponentOutletContent: any[][]; - @Input() ngComponentOutletNgModuleFactory: NgModuleFactory; + // TODO(issue/24571): remove '!'. + @Input() ngComponentOutlet !: Type; + // TODO(issue/24571): remove '!'. + @Input() ngComponentOutletInjector !: Injector; + // TODO(issue/24571): remove '!'. + @Input() ngComponentOutletContent !: any[][]; + // TODO(issue/24571): remove '!'. + @Input() ngComponentOutletNgModuleFactory !: NgModuleFactory; private _componentRef: ComponentRef|null = null; private _moduleRef: NgModuleRef|null = null; diff --git a/packages/common/src/directives/ng_for_of.ts b/packages/common/src/directives/ng_for_of.ts index 93288dc9f4..a3ca619cbd 100644 --- a/packages/common/src/directives/ng_for_of.ts +++ b/packages/common/src/directives/ng_for_of.ts @@ -114,10 +114,12 @@ export class NgForOf implements DoCheck { get ngForTrackBy(): TrackByFunction { return this._trackByFn; } - private _ngForOf: NgIterable; + // TODO(issue/24571): remove '!'. + private _ngForOf !: NgIterable; private _ngForOfDirty: boolean = true; private _differ: IterableDiffer|null = null; - private _trackByFn: TrackByFunction; + // TODO(issue/24571): remove '!'. + private _trackByFn !: TrackByFunction; constructor( private _viewContainer: ViewContainerRef, private _template: TemplateRef>, diff --git a/packages/common/src/directives/ng_plural.ts b/packages/common/src/directives/ng_plural.ts index cdf13c8374..eb489a8228 100644 --- a/packages/common/src/directives/ng_plural.ts +++ b/packages/common/src/directives/ng_plural.ts @@ -46,8 +46,10 @@ import {SwitchView} from './ng_switch'; */ @Directive({selector: '[ngPlural]'}) export class NgPlural { - private _switchValue: number; - private _activeView: SwitchView; + // TODO(issue/24571): remove '!'. + private _switchValue !: number; + // TODO(issue/24571): remove '!'. + private _activeView !: SwitchView; private _caseViews: {[k: string]: SwitchView} = {}; constructor(private _localization: NgLocalization) {} diff --git a/packages/common/src/directives/ng_style.ts b/packages/common/src/directives/ng_style.ts index 79e84548e9..9062f05b0f 100644 --- a/packages/common/src/directives/ng_style.ts +++ b/packages/common/src/directives/ng_style.ts @@ -32,8 +32,10 @@ import {Directive, DoCheck, ElementRef, Input, KeyValueChanges, KeyValueDiffer, */ @Directive({selector: '[ngStyle]'}) export class NgStyle implements DoCheck { - private _ngStyle: {[key: string]: string}; - private _differ: KeyValueDiffer; + // TODO(issue/24571): remove '!'. + private _ngStyle !: {[key: string]: string}; + // TODO(issue/24571): remove '!'. + private _differ !: KeyValueDiffer; constructor( private _differs: KeyValueDiffers, private _ngEl: ElementRef, private _renderer: Renderer2) {} diff --git a/packages/common/src/directives/ng_switch.ts b/packages/common/src/directives/ng_switch.ts index cece18504d..3f3ca39180 100644 --- a/packages/common/src/directives/ng_switch.ts +++ b/packages/common/src/directives/ng_switch.ts @@ -75,7 +75,8 @@ export class SwitchView { */ @Directive({selector: '[ngSwitch]'}) export class NgSwitch { - private _defaultViews: SwitchView[]; + // TODO(issue/24571): remove '!'. + private _defaultViews !: SwitchView[]; private _defaultUsed = false; private _caseCount = 0; private _lastCaseCheckIndex = 0; diff --git a/packages/common/src/directives/ng_template_outlet.ts b/packages/common/src/directives/ng_template_outlet.ts index 8cc2cd6dfb..d2feb77534 100644 --- a/packages/common/src/directives/ng_template_outlet.ts +++ b/packages/common/src/directives/ng_template_outlet.ts @@ -34,11 +34,14 @@ import {Directive, EmbeddedViewRef, Input, OnChanges, SimpleChange, SimpleChange */ @Directive({selector: '[ngTemplateOutlet]'}) export class NgTemplateOutlet implements OnChanges { - private _viewRef: EmbeddedViewRef; + // TODO(issue/24571): remove '!'. + private _viewRef !: EmbeddedViewRef; - @Input() public ngTemplateOutletContext: Object; + // TODO(issue/24571): remove '!'. + @Input() public ngTemplateOutletContext !: Object; - @Input() public ngTemplateOutlet: TemplateRef; + // TODO(issue/24571): remove '!'. + @Input() public ngTemplateOutlet !: TemplateRef; constructor(private _viewContainerRef: ViewContainerRef) {} diff --git a/packages/common/src/pipes/keyvalue_pipe.ts b/packages/common/src/pipes/keyvalue_pipe.ts index 0c58273af7..ec78bfc941 100644 --- a/packages/common/src/pipes/keyvalue_pipe.ts +++ b/packages/common/src/pipes/keyvalue_pipe.ts @@ -42,8 +42,10 @@ export interface KeyValue { export class KeyValuePipe implements PipeTransform { constructor(private readonly differs: KeyValueDiffers) {} - private differ: KeyValueDiffer; - private keyValues: Array>; + // TODO(issue/24571): remove '!'. + private differ !: KeyValueDiffer; + // TODO(issue/24571): remove '!'. + private keyValues !: Array>; transform(input: null, compareFn?: (a: KeyValue, b: KeyValue) => number): null; transform( diff --git a/packages/common/test/directives/ng_class_spec.ts b/packages/common/test/directives/ng_class_spec.ts index e0efe7900b..36706aa884 100644 --- a/packages/common/test/directives/ng_class_spec.ts +++ b/packages/common/test/directives/ng_class_spec.ts @@ -358,7 +358,8 @@ import {ComponentFixture, TestBed, async} from '@angular/core/testing'; @Component({selector: 'test-cmp', template: ''}) class TestComponent { condition: boolean = true; - items: any[]; + // TODO(issue/24571): remove '!'. + items !: any[]; arrExpr: string[] = ['foo']; setExpr: Set = new Set(); objExpr: {[klass: string]: any}|null = {'foo': true, 'bar': false}; diff --git a/packages/common/test/directives/ng_component_outlet_spec.ts b/packages/common/test/directives/ng_component_outlet_spec.ts index b920952a99..9a8acd16ce 100644 --- a/packages/common/test/directives/ng_component_outlet_spec.ts +++ b/packages/common/test/directives/ng_component_outlet_spec.ts @@ -224,16 +224,22 @@ const TEST_CMP_TEMPLATE = ``; @Component({selector: 'test-cmp', template: TEST_CMP_TEMPLATE}) class TestComponent { - currentComponent: Type|null; - injector: Injector; - projectables: any[][]; - module: NgModuleFactory; + // TODO(issue/24571): remove '!'. + currentComponent !: Type| null; + // TODO(issue/24571): remove '!'. + injector !: Injector; + // TODO(issue/24571): remove '!'. + projectables !: any[][]; + // TODO(issue/24571): remove '!'. + module !: NgModuleFactory; get cmpRef(): ComponentRef|null { return this.ngComponentOutlet['_componentRef']; } set cmpRef(value: ComponentRef|null) { this.ngComponentOutlet['_componentRef'] = value; } - @ViewChildren(TemplateRef) tplRefs: QueryList>; - @ViewChild(NgComponentOutlet) ngComponentOutlet: NgComponentOutlet; + // TODO(issue/24571): remove '!'. + @ViewChildren(TemplateRef) tplRefs !: QueryList>; + // TODO(issue/24571): remove '!'. + @ViewChild(NgComponentOutlet) ngComponentOutlet !: NgComponentOutlet; constructor(public vcRef: ViewContainerRef) {} } diff --git a/packages/common/test/directives/ng_template_outlet_spec.ts b/packages/common/test/directives/ng_template_outlet_spec.ts index a9bcca57e2..99dae02116 100644 --- a/packages/common/test/directives/ng_template_outlet_spec.ts +++ b/packages/common/test/directives/ng_template_outlet_spec.ts @@ -224,12 +224,14 @@ class DestroyableCmpt implements OnDestroy { @Directive({selector: 'tpl-refs', exportAs: 'tplRefs'}) class CaptureTplRefs { - @ContentChildren(TemplateRef) tplRefs: QueryList>; + // TODO(issue/24571): remove '!'. + @ContentChildren(TemplateRef) tplRefs !: QueryList>; } @Component({selector: 'test-cmp', template: ''}) class TestComponent { - currentTplRef: TemplateRef; + // TODO(issue/24571): remove '!'. + currentTplRef !: TemplateRef; context: any = {foo: 'bar'}; value = 'bar'; } diff --git a/packages/compiler-cli/integrationtest/tsconfig-build.json b/packages/compiler-cli/integrationtest/tsconfig-build.json index 8badeac4d1..511a721e2f 100644 --- a/packages/compiler-cli/integrationtest/tsconfig-build.json +++ b/packages/compiler-cli/integrationtest/tsconfig-build.json @@ -14,6 +14,7 @@ "experimentalDecorators": true, "noImplicitAny": true, "strictNullChecks": true, + "strictPropertyInitialization": true, "skipLibCheck": true, "moduleResolution": "node", "rootDir": "", diff --git a/packages/compiler-cli/integrationtest/tsconfig-ngc-build.json b/packages/compiler-cli/integrationtest/tsconfig-ngc-build.json index b3f0e8d88a..5c880dc22d 100644 --- a/packages/compiler-cli/integrationtest/tsconfig-ngc-build.json +++ b/packages/compiler-cli/integrationtest/tsconfig-ngc-build.json @@ -13,6 +13,7 @@ "experimentalDecorators": true, "noImplicitAny": true, "strictNullChecks": true, + "strictPropertyInitialization": true, "skipLibCheck": true, "moduleResolution": "node", "rootDir": "", diff --git a/packages/compiler-cli/src/diagnostics/expression_diagnostics.ts b/packages/compiler-cli/src/diagnostics/expression_diagnostics.ts index 6639332936..3b858c2468 100644 --- a/packages/compiler-cli/src/diagnostics/expression_diagnostics.ts +++ b/packages/compiler-cli/src/diagnostics/expression_diagnostics.ts @@ -185,7 +185,8 @@ export function getExpressionScope( class ExpressionDiagnosticsVisitor extends RecursiveTemplateAstVisitor { private path: TemplateAstPath; - private directiveSummary: CompileDirectiveSummary; + // TODO(issue/24571): remove '!'. + private directiveSummary !: CompileDirectiveSummary; diagnostics: ExpressionDiagnostic[] = []; diff --git a/packages/compiler-cli/src/diagnostics/expression_type.ts b/packages/compiler-cli/src/diagnostics/expression_type.ts index 9ee89e1bba..85a7ce93ed 100644 --- a/packages/compiler-cli/src/diagnostics/expression_type.ts +++ b/packages/compiler-cli/src/diagnostics/expression_type.ts @@ -23,7 +23,8 @@ export class TypeDiagnostic { // AstType calculatetype of the ast given AST element. export class AstType implements AstVisitor { - public diagnostics: TypeDiagnostic[]; + // TODO(issue/24571): remove '!'. + public diagnostics !: TypeDiagnostic[]; constructor( private scope: SymbolTable, private query: SymbolQuery, @@ -334,7 +335,8 @@ export class AstType implements AstVisitor { return this.resolvePropertyRead(this.query.getNonNullableType(this.getType(ast.receiver)), ast); } - private _anyType: Symbol; + // TODO(issue/24571): remove '!'. + private _anyType !: Symbol; private get anyType(): Symbol { let result = this._anyType; if (!result) { @@ -343,7 +345,8 @@ export class AstType implements AstVisitor { return result; } - private _undefinedType: Symbol; + // TODO(issue/24571): remove '!'. + private _undefinedType !: Symbol; private get undefinedType(): Symbol { let result = this._undefinedType; if (!result) { diff --git a/packages/compiler-cli/src/diagnostics/typescript_symbols.ts b/packages/compiler-cli/src/diagnostics/typescript_symbols.ts index da44565c41..b55e96faf2 100644 --- a/packages/compiler-cli/src/diagnostics/typescript_symbols.ts +++ b/packages/compiler-cli/src/diagnostics/typescript_symbols.ts @@ -84,7 +84,8 @@ export function getPipesTable( class TypeScriptSymbolQuery implements SymbolQuery { private typeCache = new Map(); - private pipesCache: SymbolTable; + // TODO(issue/24571): remove '!'. + private pipesCache !: SymbolTable; constructor( private program: ts.Program, private checker: ts.TypeChecker, private source: ts.SourceFile, @@ -283,8 +284,10 @@ class TypeWrapper implements Symbol { class SymbolWrapper implements Symbol { private symbol: ts.Symbol; - private _tsType: ts.Type; - private _members: SymbolTable; + // TODO(issue/24571): remove '!'. + private _tsType !: ts.Type; + // TODO(issue/24571): remove '!'. + private _members !: SymbolTable; public readonly nullable: boolean = false; public readonly language: string = 'typescript'; @@ -529,7 +532,8 @@ class PipesTable implements SymbolTable { const INDEX_PATTERN = /[\\/]([^\\/]+)[\\/]\1\.d\.ts$/; class PipeSymbol implements Symbol { - private _tsType: ts.Type; + // TODO(issue/24571): remove '!'. + private _tsType !: ts.Type; public readonly kind: DeclarationKind = 'pipe'; public readonly language: string = 'typescript'; public readonly container: Symbol|undefined = undefined; diff --git a/packages/compiler-cli/src/metadata/bundler.ts b/packages/compiler-cli/src/metadata/bundler.ts index 664f88d0d1..e039167120 100644 --- a/packages/compiler-cli/src/metadata/bundler.ts +++ b/packages/compiler-cli/src/metadata/bundler.ts @@ -85,7 +85,8 @@ export class MetadataBundler { private exports = new Map(); private rootModule: string; private privateSymbolPrefix: string; - private exported: Set; + // TODO(issue/24571): remove '!'. + private exported !: Set; constructor( private root: string, private importAs: string|undefined, private host: MetadataBundlerHost, diff --git a/packages/compiler-cli/src/metadata/symbols.ts b/packages/compiler-cli/src/metadata/symbols.ts index 1401709390..afd7aff827 100644 --- a/packages/compiler-cli/src/metadata/symbols.ts +++ b/packages/compiler-cli/src/metadata/symbols.ts @@ -11,7 +11,8 @@ import * as ts from 'typescript'; import {MetadataSymbolicReferenceExpression, MetadataValue} from './schema'; export class Symbols { - private _symbols: Map; + // TODO(issue/24571): remove '!'. + private _symbols !: Map; private references = new Map(); constructor(private sourceFile: ts.SourceFile) {} diff --git a/packages/compiler-cli/src/ngtsc/metadata/src/resolver.ts b/packages/compiler-cli/src/ngtsc/metadata/src/resolver.ts index f97e509cfb..e84c84b52e 100644 --- a/packages/compiler-cli/src/ngtsc/metadata/src/resolver.ts +++ b/packages/compiler-cli/src/ngtsc/metadata/src/resolver.ts @@ -88,7 +88,8 @@ export abstract class Reference { /** * Whether an `Expression` can be generated which references the node. */ - readonly expressable: boolean; + // TODO(issue/24571): remove '!'. + readonly expressable !: boolean; /** * Generate an `Expression` representing this type, in the context of the given SourceFile. diff --git a/packages/compiler-cli/src/ngtsc/transform/src/compilation.ts b/packages/compiler-cli/src/ngtsc/transform/src/compilation.ts index 3500683998..bebda19a99 100644 --- a/packages/compiler-cli/src/ngtsc/transform/src/compilation.ts +++ b/packages/compiler-cli/src/ngtsc/transform/src/compilation.ts @@ -120,7 +120,7 @@ export class IvyCompilation { // Look up the .d.ts transformer for the input file and record that a field was generated, // which will allow the .d.ts to be transformed later. - const fileName = node.getSourceFile().fileName; + const fileName = original.getSourceFile().fileName; const dtsTransformer = this.getDtsTransformer(fileName); dtsTransformer.recordStaticField(reflectNameOfDeclaration(node) !, res); diff --git a/packages/compiler-cli/src/transformers/compiler_host.ts b/packages/compiler-cli/src/transformers/compiler_host.ts index 344b21eeb3..683d4a05c3 100644 --- a/packages/compiler-cli/src/transformers/compiler_host.ts +++ b/packages/compiler-cli/src/transformers/compiler_host.ts @@ -74,10 +74,14 @@ export class TsCompilerAotCompilerTypeCheckHostAdapter implements ts.CompilerHos private emitter = new TypeScriptEmitter(); private metadataReaderHost: MetadataReaderHost; - getCancellationToken: () => ts.CancellationToken; - getDefaultLibLocation: () => string; - trace: (s: string) => void; - getDirectories: (path: string) => string[]; + // TODO(issue/24571): remove '!'. + getCancellationToken !: () => ts.CancellationToken; + // TODO(issue/24571): remove '!'. + getDefaultLibLocation !: () => string; + // TODO(issue/24571): remove '!'. + trace !: (s: string) => void; + // TODO(issue/24571): remove '!'. + getDirectories !: (path: string) => string[]; directoryExists?: (directoryName: string) => boolean; constructor( diff --git a/packages/compiler-cli/src/transformers/lower_expressions.ts b/packages/compiler-cli/src/transformers/lower_expressions.ts index dbdf027d51..6f346b7547 100644 --- a/packages/compiler-cli/src/transformers/lower_expressions.ts +++ b/packages/compiler-cli/src/transformers/lower_expressions.ts @@ -252,7 +252,8 @@ function isLiteralFieldNamed(node: ts.Node, names: Set): boolean { } export class LowerMetadataTransform implements RequestsMap, MetadataTransformer { - private cache: MetadataCache; + // TODO(issue/24571): remove '!'. + private cache !: MetadataCache; private requests = new Map(); private lowerableFieldNames: Set; diff --git a/packages/compiler-cli/src/transformers/program.ts b/packages/compiler-cli/src/transformers/program.ts index 5b9f4c67fc..a21fb7bf3d 100644 --- a/packages/compiler-cli/src/transformers/program.ts +++ b/packages/compiler-cli/src/transformers/program.ts @@ -115,7 +115,8 @@ class AngularCompilerProgram implements Program { private rootNames: string[]; private metadataCache: MetadataCache; // Metadata cache used exclusively for the flat module index - private flatModuleMetadataCache: MetadataCache; + // TODO(issue/24571): remove '!'. + private flatModuleMetadataCache !: MetadataCache; private loweringMetadataTransform: LowerMetadataTransform; private oldProgramLibrarySummaries: Map|undefined; private oldProgramEmittedGeneratedFiles: Map|undefined; @@ -127,15 +128,19 @@ class AngularCompilerProgram implements Program { private emittedSourceFiles: ts.SourceFile[]|undefined; // Lazily initialized fields - private _compiler: AotCompiler; - private _hostAdapter: TsCompilerAotCompilerTypeCheckHostAdapter; - private _tsProgram: ts.Program; + // TODO(issue/24571): remove '!'. + private _compiler !: AotCompiler; + // TODO(issue/24571): remove '!'. + private _hostAdapter !: TsCompilerAotCompilerTypeCheckHostAdapter; + // TODO(issue/24571): remove '!'. + private _tsProgram !: ts.Program; private _analyzedModules: NgAnalyzedModules|undefined; private _analyzedInjectables: NgAnalyzedFileWithInjectables[]|undefined; private _structuralDiagnostics: Diagnostic[]|undefined; private _programWithStubs: ts.Program|undefined; private _optionsDiagnostics: Diagnostic[] = []; - private _reifiedDecorators: Set; + // TODO(issue/24571): remove '!'. + private _reifiedDecorators !: Set; constructor( rootNames: ReadonlyArray, private options: CompilerOptions, diff --git a/packages/compiler-cli/test/diagnostics/mocks.ts b/packages/compiler-cli/test/diagnostics/mocks.ts index 98fd240dad..aa3fefbcc4 100644 --- a/packages/compiler-cli/test/diagnostics/mocks.ts +++ b/packages/compiler-cli/test/diagnostics/mocks.ts @@ -117,12 +117,14 @@ const summaryResolver = new AotSummaryResolver( export class DiagnosticContext { // tslint:disable - _analyzedModules: NgAnalyzedModules; + // TODO(issue/24571): remove '!'. + _analyzedModules !: NgAnalyzedModules; _staticSymbolResolver: StaticSymbolResolver|undefined; _reflector: StaticReflector|undefined; _errors: {e: any, path?: string}[] = []; _resolver: CompileMetadataResolver|undefined; - _refletor: StaticReflector; + // TODO(issue/24571): remove '!'. + _refletor !: StaticReflector; // tslint:enable constructor( diff --git a/packages/compiler-cli/test/metadata/typescript.mocks.ts b/packages/compiler-cli/test/metadata/typescript.mocks.ts index 93f7438cc9..43521908d2 100644 --- a/packages/compiler-cli/test/metadata/typescript.mocks.ts +++ b/packages/compiler-cli/test/metadata/typescript.mocks.ts @@ -102,7 +102,8 @@ export class MockNode implements ts.Node { export class MockIdentifier extends MockNode implements ts.Identifier { public text: string; - public escapedText: ts.__String; + // TODO(issue/24571): remove '!'. + public escapedText !: ts.__String; // tslint:disable public _declarationBrand: any; public _primaryExpressionBrand: any; @@ -139,7 +140,8 @@ export class MockVariableDeclaration extends MockNode implements ts.VariableDecl } export class MockSymbol implements ts.Symbol { - public escapedName: ts.__String; + // TODO(issue/24571): remove '!'. + public escapedName !: ts.__String; constructor( public name: string, private node: ts.Declaration = MockVariableDeclaration.of(name), public flags: ts.SymbolFlags = 0) {} diff --git a/packages/compiler/src/aot/static_reflector.ts b/packages/compiler/src/aot/static_reflector.ts index dafdeef709..3e67872937 100644 --- a/packages/compiler/src/aot/static_reflector.ts +++ b/packages/compiler/src/aot/static_reflector.ts @@ -49,10 +49,14 @@ export class StaticReflector implements CompileReflector { private staticCache = new Map(); private conversionMap = new Map any>(); private resolvedExternalReferences = new Map(); - private injectionToken: StaticSymbol; - private opaqueToken: StaticSymbol; - ROUTES: StaticSymbol; - private ANALYZE_FOR_ENTRY_COMPONENTS: StaticSymbol; + // TODO(issue/24571): remove '!'. + private injectionToken !: StaticSymbol; + // TODO(issue/24571): remove '!'. + private opaqueToken !: StaticSymbol; + // TODO(issue/24571): remove '!'. + ROUTES !: StaticSymbol; + // TODO(issue/24571): remove '!'. + private ANALYZE_FOR_ENTRY_COMPONENTS !: StaticSymbol; private annotationForParentClassWithSummaryKind = new Map[]>(); diff --git a/packages/compiler/src/aot/summary_serializer.ts b/packages/compiler/src/aot/summary_serializer.ts index 47d63cb6c5..1b6d44885d 100644 --- a/packages/compiler/src/aot/summary_serializer.ts +++ b/packages/compiler/src/aot/summary_serializer.ts @@ -421,7 +421,8 @@ class ForJitSerializer { } class FromJsonDeserializer extends ValueTransformer { - private symbols: StaticSymbol[]; + // TODO(issue/24571): remove '!'. + private symbols !: StaticSymbol[]; constructor( private symbolCache: StaticSymbolCache, diff --git a/packages/compiler/src/compile_metadata.ts b/packages/compiler/src/compile_metadata.ts index 6571596514..faf8737b4d 100644 --- a/packages/compiler/src/compile_metadata.ts +++ b/packages/compiler/src/compile_metadata.ts @@ -528,7 +528,8 @@ export interface CompileNgModuleSummary extends CompileTypeSummary { } export class CompileShallowModuleMetadata { - type: CompileTypeMetadata; + // TODO(issue/24571): remove '!'. + type !: CompileTypeMetadata; rawExports: any; rawImports: any; diff --git a/packages/compiler/src/constant_pool.ts b/packages/compiler/src/constant_pool.ts index 58a40a7eba..81feef39f0 100644 --- a/packages/compiler/src/constant_pool.ts +++ b/packages/compiler/src/constant_pool.ts @@ -40,7 +40,8 @@ const KEY_CONTEXT = {}; class FixupExpression extends o.Expression { private original: o.Expression; - shared: boolean; + // TODO(issue/24571): remove '!'. + shared !: boolean; constructor(public resolved: o.Expression) { super(resolved.type); diff --git a/packages/compiler/src/css_parser/css_lexer.ts b/packages/compiler/src/css_parser/css_lexer.ts index 49d84da577..ea574dbf95 100644 --- a/packages/compiler/src/css_parser/css_lexer.ts +++ b/packages/compiler/src/css_parser/css_lexer.ts @@ -116,7 +116,8 @@ function _trackWhitespace(mode: CssLexerMode) { } export class CssScanner { - peek: number; + // TODO(issue/24571): remove '!'. + peek !: number; peekPeek: number; length: number = 0; index: number = -1; diff --git a/packages/compiler/src/css_parser/css_parser.ts b/packages/compiler/src/css_parser/css_parser.ts index cf283a6cea..2650e3deec 100644 --- a/packages/compiler/src/css_parser/css_parser.ts +++ b/packages/compiler/src/css_parser/css_parser.ts @@ -83,9 +83,12 @@ export class ParsedCssResult { export class CssParser { private _errors: CssParseError[] = []; - private _file: ParseSourceFile; - private _scanner: CssScanner; - private _lastToken: CssToken; + // TODO(issue/24571): remove '!'. + private _file !: ParseSourceFile; + // TODO(issue/24571): remove '!'. + private _scanner !: CssScanner; + // TODO(issue/24571): remove '!'. + private _lastToken !: CssToken; /** * @param css the CSS code that will be parsed diff --git a/packages/compiler/src/i18n/extractor_merger.ts b/packages/compiler/src/i18n/extractor_merger.ts index 2f29634a9b..4d37f489da 100644 --- a/packages/compiler/src/i18n/extractor_merger.ts +++ b/packages/compiler/src/i18n/extractor_merger.ts @@ -55,33 +55,46 @@ enum _VisitorMode { * @internal */ class _Visitor implements html.Visitor { - private _depth: number; + // TODO(issue/24571): remove '!'. + private _depth !: number; // ... - private _inI18nNode: boolean; - private _inImplicitNode: boolean; + // TODO(issue/24571): remove '!'. + private _inI18nNode !: boolean; + // TODO(issue/24571): remove '!'. + private _inImplicitNode !: boolean; // ... - private _inI18nBlock: boolean; - private _blockMeaningAndDesc: string; - private _blockChildren: html.Node[]; - private _blockStartDepth: number; + // TODO(issue/24571): remove '!'. + private _inI18nBlock !: boolean; + // TODO(issue/24571): remove '!'. + private _blockMeaningAndDesc !: string; + // TODO(issue/24571): remove '!'. + private _blockChildren !: html.Node[]; + // TODO(issue/24571): remove '!'. + private _blockStartDepth !: number; // {} - private _inIcu: boolean; + // TODO(issue/24571): remove '!'. + private _inIcu !: boolean; // set to void 0 when not in a section private _msgCountAtSectionStart: number|undefined; - private _errors: I18nError[]; - private _mode: _VisitorMode; + // TODO(issue/24571): remove '!'. + private _errors !: I18nError[]; + // TODO(issue/24571): remove '!'. + private _mode !: _VisitorMode; // _VisitorMode.Extract only - private _messages: i18n.Message[]; + // TODO(issue/24571): remove '!'. + private _messages !: i18n.Message[]; // _VisitorMode.Merge only - private _translations: TranslationBundle; - private _createI18nMessage: - (msg: html.Node[], meaning: string, description: string, id: string) => i18n.Message; + // TODO(issue/24571): remove '!'. + private _translations !: TranslationBundle; + // TODO(issue/24571): remove '!'. + private _createI18nMessage !: ( + msg: html.Node[], meaning: string, description: string, id: string) => i18n.Message; constructor(private _implicitTags: string[], private _implicitAttrs: {[k: string]: string[]}) {} diff --git a/packages/compiler/src/i18n/i18n_ast.ts b/packages/compiler/src/i18n/i18n_ast.ts index 931a5e4675..fd2fd93034 100644 --- a/packages/compiler/src/i18n/i18n_ast.ts +++ b/packages/compiler/src/i18n/i18n_ast.ts @@ -65,7 +65,8 @@ export class Container implements Node { } export class Icu implements Node { - public expressionPlaceholder: string; + // TODO(issue/24571): remove '!'. + public expressionPlaceholder !: string; constructor( public expression: string, public type: string, public cases: {[k: string]: Node}, public sourceSpan: ParseSourceSpan) {} diff --git a/packages/compiler/src/i18n/i18n_parser.ts b/packages/compiler/src/i18n/i18n_parser.ts index 708a8e8c00..815d58c2ff 100644 --- a/packages/compiler/src/i18n/i18n_parser.ts +++ b/packages/compiler/src/i18n/i18n_parser.ts @@ -30,11 +30,16 @@ export function createI18nMessageFactory(interpolationConfig: InterpolationConfi } class _I18nVisitor implements html.Visitor { - private _isIcu: boolean; - private _icuDepth: number; - private _placeholderRegistry: PlaceholderRegistry; - private _placeholderToContent: {[phName: string]: string}; - private _placeholderToMessage: {[phName: string]: i18n.Message}; + // TODO(issue/24571): remove '!'. + private _isIcu !: boolean; + // TODO(issue/24571): remove '!'. + private _icuDepth !: number; + // TODO(issue/24571): remove '!'. + private _placeholderRegistry !: PlaceholderRegistry; + // TODO(issue/24571): remove '!'. + private _placeholderToContent !: {[phName: string]: string}; + // TODO(issue/24571): remove '!'. + private _placeholderToMessage !: {[phName: string]: i18n.Message}; constructor( private _expressionParser: ExpressionParser, diff --git a/packages/compiler/src/i18n/serializers/xliff.ts b/packages/compiler/src/i18n/serializers/xliff.ts index fb64794daa..e1efddd9d5 100644 --- a/packages/compiler/src/i18n/serializers/xliff.ts +++ b/packages/compiler/src/i18n/serializers/xliff.ts @@ -173,9 +173,12 @@ class _WriteVisitor implements i18n.Visitor { // TODO(vicb): add error management (structure) // Extract messages as xml nodes from the xliff file class XliffParser implements ml.Visitor { - private _unitMlString: string|null; - private _errors: I18nError[]; - private _msgIdToHtml: {[msgId: string]: string}; + // TODO(issue/24571): remove '!'. + private _unitMlString !: string | null; + // TODO(issue/24571): remove '!'. + private _errors !: I18nError[]; + // TODO(issue/24571): remove '!'. + private _msgIdToHtml !: {[msgId: string]: string}; private _locale: string|null = null; parse(xliff: string, url: string) { @@ -261,7 +264,8 @@ class XliffParser implements ml.Visitor { // Convert ml nodes (xliff syntax) to i18n nodes class XmlToI18n implements ml.Visitor { - private _errors: I18nError[]; + // TODO(issue/24571): remove '!'. + private _errors !: I18nError[]; convert(message: string, url: string) { const xmlIcu = new XmlParser().parse(message, url, true); diff --git a/packages/compiler/src/i18n/serializers/xliff2.ts b/packages/compiler/src/i18n/serializers/xliff2.ts index eac6612f5d..f43382349f 100644 --- a/packages/compiler/src/i18n/serializers/xliff2.ts +++ b/packages/compiler/src/i18n/serializers/xliff2.ts @@ -112,7 +112,8 @@ export class Xliff2 extends Serializer { } class _WriteVisitor implements i18n.Visitor { - private _nextPlaceholderId: number; + // TODO(issue/24571): remove '!'. + private _nextPlaceholderId !: number; visitText(text: i18n.Text, context?: any): xml.Node[] { return [new xml.Text(text.value)]; } @@ -190,9 +191,12 @@ class _WriteVisitor implements i18n.Visitor { // Extract messages as xml nodes from the xliff file class Xliff2Parser implements ml.Visitor { - private _unitMlString: string|null; - private _errors: I18nError[]; - private _msgIdToHtml: {[msgId: string]: string}; + // TODO(issue/24571): remove '!'. + private _unitMlString !: string | null; + // TODO(issue/24571): remove '!'. + private _errors !: I18nError[]; + // TODO(issue/24571): remove '!'. + private _msgIdToHtml !: {[msgId: string]: string}; private _locale: string|null = null; parse(xliff: string, url: string) { @@ -285,7 +289,8 @@ class Xliff2Parser implements ml.Visitor { // Convert ml nodes (xliff syntax) to i18n nodes class XmlToI18n implements ml.Visitor { - private _errors: I18nError[]; + // TODO(issue/24571): remove '!'. + private _errors !: I18nError[]; convert(message: string, url: string) { const xmlIcu = new XmlParser().parse(message, url, true); diff --git a/packages/compiler/src/i18n/serializers/xtb.ts b/packages/compiler/src/i18n/serializers/xtb.ts index c0259d6b94..c544bc9d70 100644 --- a/packages/compiler/src/i18n/serializers/xtb.ts +++ b/packages/compiler/src/i18n/serializers/xtb.ts @@ -74,9 +74,12 @@ function createLazyProperty(messages: any, id: string, valueFn: () => any) { // Extract messages as xml nodes from the xtb file class XtbParser implements ml.Visitor { - private _bundleDepth: number; - private _errors: I18nError[]; - private _msgIdToHtml: {[msgId: string]: string}; + // TODO(issue/24571): remove '!'. + private _bundleDepth !: number; + // TODO(issue/24571): remove '!'. + private _errors !: I18nError[]; + // TODO(issue/24571): remove '!'. + private _msgIdToHtml !: {[msgId: string]: string}; private _locale: string|null = null; parse(xtb: string, url: string) { @@ -152,7 +155,8 @@ class XtbParser implements ml.Visitor { // Convert ml nodes (xtb syntax) to i18n nodes class XmlToI18n implements ml.Visitor { - private _errors: I18nError[]; + // TODO(issue/24571): remove '!'. + private _errors !: I18nError[]; convert(message: string, url: string) { const xmlIcu = new XmlParser().parse(message, url, true); diff --git a/packages/compiler/src/i18n/translation_bundle.ts b/packages/compiler/src/i18n/translation_bundle.ts index 242ff966d8..cb6fb4f01c 100644 --- a/packages/compiler/src/i18n/translation_bundle.ts +++ b/packages/compiler/src/i18n/translation_bundle.ts @@ -60,10 +60,12 @@ export class TranslationBundle { } class I18nToHtmlVisitor implements i18n.Visitor { - private _srcMsg: i18n.Message; + // TODO(issue/24571): remove '!'. + private _srcMsg !: i18n.Message; private _contextStack: {msg: i18n.Message, mapper: (name: string) => string}[] = []; private _errors: I18nError[] = []; - private _mapper: (name: string) => string; + // TODO(issue/24571): remove '!'. + private _mapper !: (name: string) => string; constructor( private _i18nNodesByMsgId: {[msgId: string]: i18n.Node[]} = {}, private _locale: string|null, diff --git a/packages/compiler/src/ml_parser/html_tags.ts b/packages/compiler/src/ml_parser/html_tags.ts index 351265b642..9d3da64f4e 100644 --- a/packages/compiler/src/ml_parser/html_tags.ts +++ b/packages/compiler/src/ml_parser/html_tags.ts @@ -12,8 +12,10 @@ export class HtmlTagDefinition implements TagDefinition { private closedByChildren: {[key: string]: boolean} = {}; closedByParent: boolean = false; - requiredParents: {[key: string]: boolean}; - parentToAdd: string; + // TODO(issue/24571): remove '!'. + requiredParents !: {[key: string]: boolean}; + // TODO(issue/24571): remove '!'. + parentToAdd !: string; implicitNamespacePrefix: string|null; contentType: TagContentType; isVoid: boolean; diff --git a/packages/compiler/src/ml_parser/lexer.ts b/packages/compiler/src/ml_parser/lexer.ts index 28adb6e27f..22fd6fc994 100644 --- a/packages/compiler/src/ml_parser/lexer.ts +++ b/packages/compiler/src/ml_parser/lexer.ts @@ -84,8 +84,10 @@ class _Tokenizer { private _index: number = -1; private _line: number = 0; private _column: number = -1; - private _currentTokenStart: ParseLocation; - private _currentTokenType: TokenType; + // TODO(issue/24571): remove '!'. + private _currentTokenStart !: ParseLocation; + // TODO(issue/24571): remove '!'. + private _currentTokenType !: TokenType; private _expansionCaseStack: TokenType[] = []; private _inInterpolation: boolean = false; diff --git a/packages/compiler/src/ml_parser/parser.ts b/packages/compiler/src/ml_parser/parser.ts index ab6a7c29f7..3a06bc182d 100644 --- a/packages/compiler/src/ml_parser/parser.ts +++ b/packages/compiler/src/ml_parser/parser.ts @@ -46,7 +46,8 @@ export class Parser { class _TreeBuilder { private _index: number = -1; - private _peek: lex.Token; + // TODO(issue/24571): remove '!'. + private _peek !: lex.Token; private _rootNodes: html.Node[] = []; private _errors: TreeError[] = []; diff --git a/packages/compiler/src/ml_parser/xml_tags.ts b/packages/compiler/src/ml_parser/xml_tags.ts index 6acc2f5363..ab52c15dd1 100644 --- a/packages/compiler/src/ml_parser/xml_tags.ts +++ b/packages/compiler/src/ml_parser/xml_tags.ts @@ -10,9 +10,12 @@ import {TagContentType, TagDefinition} from './tags'; export class XmlTagDefinition implements TagDefinition { closedByParent: boolean = false; - requiredParents: {[key: string]: boolean}; - parentToAdd: string; - implicitNamespacePrefix: string; + // TODO(issue/24571): remove '!'. + requiredParents !: {[key: string]: boolean}; + // TODO(issue/24571): remove '!'. + parentToAdd !: string; + // TODO(issue/24571): remove '!'. + implicitNamespacePrefix !: string; contentType: TagContentType = TagContentType.PARSABLE_DATA; isVoid: boolean = false; ignoreFirstLf: boolean = false; diff --git a/packages/compiler/test/expression_parser/utils/unparser.ts b/packages/compiler/test/expression_parser/utils/unparser.ts index da27bfcbfb..e5ea2f9f89 100644 --- a/packages/compiler/test/expression_parser/utils/unparser.ts +++ b/packages/compiler/test/expression_parser/utils/unparser.ts @@ -11,8 +11,10 @@ import {DEFAULT_INTERPOLATION_CONFIG, InterpolationConfig} from '../../../src/ml class Unparser implements AstVisitor { private static _quoteRegExp = /"/g; - private _expression: string; - private _interpolationConfig: InterpolationConfig; + // TODO(issue/24571): remove '!'. + private _expression !: string; + // TODO(issue/24571): remove '!'. + private _interpolationConfig !: InterpolationConfig; unparse(ast: AST, interpolationConfig: InterpolationConfig) { this._expression = ''; diff --git a/packages/compiler/test/i18n/integration_common.ts b/packages/compiler/test/i18n/integration_common.ts index 11027cbf75..2b59094aae 100644 --- a/packages/compiler/test/i18n/integration_common.ts +++ b/packages/compiler/test/i18n/integration_common.ts @@ -19,9 +19,12 @@ import {expect} from '@angular/platform-browser/testing/src/matchers'; template: '', }) export class I18nComponent { - count: number; - sex: string; - sexB: string; + // TODO(issue/24571): remove '!'. + count !: number; + // TODO(issue/24571): remove '!'. + sex !: string; + // TODO(issue/24571): remove '!'. + sexB !: string; response: any = {getItemsList: (): any[] => []}; } diff --git a/packages/compiler/test/integration_spec.ts b/packages/compiler/test/integration_spec.ts index 34587b2ac1..da7f870600 100644 --- a/packages/compiler/test/integration_spec.ts +++ b/packages/compiler/test/integration_spec.ts @@ -20,7 +20,8 @@ import {expect} from '@angular/platform-browser/testing/src/matchers'; it('should support dotted selectors', async(() => { @Directive({selector: '[dot.name]'}) class MyDir { - @Input('dot.name') value: string; + // TODO(issue/24571): remove '!'. + @Input('dot.name') value !: string; } TestBed.configureTestingModule({ diff --git a/packages/compiler/testing/src/resource_loader_mock.ts b/packages/compiler/testing/src/resource_loader_mock.ts index 230fa1caf1..e64c744960 100644 --- a/packages/compiler/testing/src/resource_loader_mock.ts +++ b/packages/compiler/testing/src/resource_loader_mock.ts @@ -99,8 +99,10 @@ export class MockResourceLoader extends ResourceLoader { } class _PendingRequest { - resolve: (result: string) => void; - reject: (error: any) => void; + // TODO(issue/24571): remove '!'. + resolve !: (result: string) => void; + // TODO(issue/24571): remove '!'. + reject !: (error: any) => void; promise: Promise; constructor(public url: string) { diff --git a/packages/compiler/tsconfig-build.json b/packages/compiler/tsconfig-build.json index 46fbc6492f..d59d031f3b 100644 --- a/packages/compiler/tsconfig-build.json +++ b/packages/compiler/tsconfig-build.json @@ -7,6 +7,7 @@ "experimentalDecorators": true, "noImplicitAny": true, "strictNullChecks": true, + "strictPropertyInitialization": true, "noFallthroughCasesInSwitch": true, "module": "es2015", "moduleResolution": "node", diff --git a/packages/core/src/application_init.ts b/packages/core/src/application_init.ts index 554c120d9d..945a776fd9 100644 --- a/packages/core/src/application_init.ts +++ b/packages/core/src/application_init.ts @@ -24,8 +24,10 @@ export const APP_INITIALIZER = new InjectionToken void>>('Applicatio */ @Injectable() export class ApplicationInitStatus { - private resolve: Function; - private reject: Function; + // TODO(issue/24571): remove '!'. + private resolve !: Function; + // TODO(issue/24571): remove '!'. + private reject !: Function; private initialized = false; public readonly donePromise: Promise; public readonly done = false; diff --git a/packages/core/src/application_ref.ts b/packages/core/src/application_ref.ts index 2f3beb8622..9ec754f3ab 100644 --- a/packages/core/src/application_ref.ts +++ b/packages/core/src/application_ref.ts @@ -383,7 +383,8 @@ export class ApplicationRef { /** * Returns an Observable that indicates when the application is stable or unstable. */ - public readonly isStable: Observable; + // TODO(issue/24571): remove '!'. + public readonly isStable !: Observable; /** @internal */ constructor( diff --git a/packages/core/src/change_detection/differs/default_iterable_differ.ts b/packages/core/src/change_detection/differs/default_iterable_differ.ts index ac917e63f0..bf67045dc2 100644 --- a/packages/core/src/change_detection/differs/default_iterable_differ.ts +++ b/packages/core/src/change_detection/differs/default_iterable_differ.ts @@ -27,7 +27,8 @@ const trackByIdentity = (index: number, item: any) => item; */ export class DefaultIterableDiffer implements IterableDiffer, IterableChanges { public readonly length: number = 0; - public readonly collection: V[]|Iterable|null; + // TODO(issue/24571): remove '!'. + public readonly collection !: V[] | Iterable| null; // Keeps track of the used records at any point in time (during & across `_check()` calls) private _linkedRecords: _DuplicateMap|null = null; // Keeps track of the removed records at any point in time during `_check()` calls. diff --git a/packages/core/src/debug/debug_node.ts b/packages/core/src/debug/debug_node.ts index ece2a45084..78fbdd0d77 100644 --- a/packages/core/src/debug/debug_node.ts +++ b/packages/core/src/debug/debug_node.ts @@ -19,7 +19,8 @@ export class EventListener { export class DebugNode { nativeNode: any; listeners: EventListener[]; - parent: DebugElement|null; + // TODO(issue/24571): remove '!'. + parent !: DebugElement | null; constructor(nativeNode: any, parent: DebugNode|null, private _debugContext: DebugContext) { this.nativeNode = nativeNode; @@ -46,7 +47,8 @@ export class DebugNode { * @experimental All debugging apis are currently experimental. */ export class DebugElement extends DebugNode { - name: string; + // TODO(issue/24571): remove '!'. + name !: string; properties: {[key: string]: any}; attributes: {[key: string]: string | null}; classes: {[key: string]: boolean}; diff --git a/packages/core/src/linker/query_list.ts b/packages/core/src/linker/query_list.ts index eeb0026a16..fd06b021f4 100644 --- a/packages/core/src/linker/query_list.ts +++ b/packages/core/src/linker/query_list.ts @@ -42,8 +42,10 @@ export class QueryList/* implements Iterable */ { public readonly changes: Observable = new EventEmitter(); readonly length: number = 0; - readonly first: T; - readonly last: T; + // TODO(issue/24571): remove '!'. + readonly first !: T; + // TODO(issue/24571): remove '!'. + readonly last !: T; /** * See diff --git a/packages/core/src/linker/system_js_ng_module_factory_loader.ts b/packages/core/src/linker/system_js_ng_module_factory_loader.ts index d5540aca8b..b377c2e718 100644 --- a/packages/core/src/linker/system_js_ng_module_factory_loader.ts +++ b/packages/core/src/linker/system_js_ng_module_factory_loader.ts @@ -28,12 +28,14 @@ export abstract class SystemJsNgModuleLoaderConfig { /** * Prefix to add when computing the name of the factory module for a given module name. */ - factoryPathPrefix: string; + // TODO(issue/24571): remove '!'. + factoryPathPrefix !: string; /** * Suffix to add when computing the name of the factory module for a given module name. */ - factoryPathSuffix: string; + // TODO(issue/24571): remove '!'. + factoryPathSuffix !: string; } const DEFAULT_CONFIG: SystemJsNgModuleLoaderConfig = { diff --git a/packages/core/src/render/api.ts b/packages/core/src/render/api.ts index 61c7e5657b..ac80fd769c 100644 --- a/packages/core/src/render/api.ts +++ b/packages/core/src/render/api.ts @@ -159,7 +159,8 @@ export abstract class Renderer2 { * in which case the view engine won't call it. * This is used as a performance optimization for production mode. */ - destroyNode: ((node: any) => void)|null; + // TODO(issue/24571): remove '!'. + destroyNode !: ((node: any) => void) | null; abstract appendChild(parent: any, newChild: any): void; abstract insertBefore(parent: any, newChild: any, refChild: any): void; abstract removeChild(parent: any, oldChild: any): void; diff --git a/packages/core/src/render3/di.ts b/packages/core/src/render3/di.ts index d5a9b3a84f..ecd0bf65f4 100644 --- a/packages/core/src/render3/di.ts +++ b/packages/core/src/render3/di.ts @@ -606,9 +606,12 @@ export function getOrCreateContainerRef(di: LInjector): viewEngine_ViewContainer */ class ViewContainerRef implements viewEngine_ViewContainerRef { private _viewRefs: viewEngine_ViewRef[] = []; - element: viewEngine_ElementRef; - injector: Injector; - parentInjector: Injector; + // TODO(issue/24571): remove '!'. + element !: viewEngine_ElementRef; + // TODO(issue/24571): remove '!'. + injector !: Injector; + // TODO(issue/24571): remove '!'. + parentInjector !: Injector; constructor(private _lContainerNode: LContainerNode) {} diff --git a/packages/core/src/render3/view_ref.ts b/packages/core/src/render3/view_ref.ts index e88cdd489b..6bf5d4e6b6 100644 --- a/packages/core/src/render3/view_ref.ts +++ b/packages/core/src/render3/view_ref.ts @@ -24,10 +24,12 @@ export interface viewEngine_ChangeDetectorRef_interface extends viewEngine_Chang export class ViewRef implements viewEngine_EmbeddedViewRef, viewEngine_InternalViewRef, viewEngine_ChangeDetectorRef_interface { - private _appRef: ApplicationRef|null; + // TODO(issue/24571): remove '!'. + private _appRef !: ApplicationRef | null; context: T; - rootNodes: any[]; + // TODO(issue/24571): remove '!'. + rootNodes !: any[]; constructor(protected _view: LViewData, context: T|null) { this.context = context !; } diff --git a/packages/core/src/view/refs.ts b/packages/core/src/view/refs.ts index 0daada3109..72a44d6b5d 100644 --- a/packages/core/src/view/refs.ts +++ b/packages/core/src/view/refs.ts @@ -311,7 +311,8 @@ class TemplateRef_ extends TemplateRef implements TemplateData { /** * @internal */ - _projectedViews: ViewData[]; + // TODO(issue/24571): remove '!'. + _projectedViews !: ViewData[]; constructor(private _parentView: ViewData, private _def: NodeDef) { super(); } @@ -479,9 +480,11 @@ class NgModuleRef_ implements NgModuleData, InternalNgModuleRef { private _destroyListeners: (() => void)[] = []; private _destroyed: boolean = false; /** @internal */ - _providers: any[]; + // TODO(issue/24571): remove '!'. + _providers !: any[]; /** @internal */ - _modules: any[]; + // TODO(issue/24571): remove '!'. + _modules !: any[]; readonly injector: Injector = this; diff --git a/packages/core/test/animation/animation_integration_spec.ts b/packages/core/test/animation/animation_integration_spec.ts index f94bca7d0c..4aafeca023 100644 --- a/packages/core/test/animation/animation_integration_spec.ts +++ b/packages/core/test/animation/animation_integration_spec.ts @@ -1636,7 +1636,8 @@ const DEFAULT_COMPONENT_ID = '1'; ] }) class Cmp { - public exp: string|null; + // TODO(issue/24571): remove '!'. + public exp !: string | null; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -2023,7 +2024,8 @@ const DEFAULT_COMPONENT_ID = '1'; }) class Cmp { public exp: any; - public color: string|null; + // TODO(issue/24571): remove '!'. + public color !: string | null; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -2456,7 +2458,8 @@ const DEFAULT_COMPONENT_ID = '1'; }) class Cmp { exp: any = false; - event: AnimationEvent; + // TODO(issue/24571): remove '!'. + event !: AnimationEvent; callback = (event: any) => { this.event = event; }; } @@ -2491,7 +2494,8 @@ const DEFAULT_COMPONENT_ID = '1'; }) class Cmp { exp: any = false; - event: AnimationEvent; + // TODO(issue/24571): remove '!'. + event !: AnimationEvent; callback = (event: any) => { this.event = event; }; } @@ -2546,8 +2550,10 @@ const DEFAULT_COMPONENT_ID = '1'; class Cmp { exp1: any = false; exp2: any = false; - event1: AnimationEvent; - event2: AnimationEvent; + // TODO(issue/24571): remove '!'. + event1 !: AnimationEvent; + // TODO(issue/24571): remove '!'. + event2 !: AnimationEvent; // tslint:disable:semicolon callback1 = (event: any) => { this.event1 = event; }; // tslint:disable:semicolon @@ -2608,8 +2614,10 @@ const DEFAULT_COMPONENT_ID = '1'; class Cmp { exp1: any = false; exp2: any = false; - event1: AnimationEvent; - event2: AnimationEvent; + // TODO(issue/24571): remove '!'. + event1 !: AnimationEvent; + // TODO(issue/24571): remove '!'. + event2 !: AnimationEvent; callback1 = (event: any) => { this.event1 = event; }; callback2 = (event: any) => { this.event2 = event; }; } @@ -2713,7 +2721,8 @@ const DEFAULT_COMPONENT_ID = '1'; [style({'opacity': '0'}), animate(1000, style({'opacity': '1'}))])])], }) class Cmp { - event: AnimationEvent; + // TODO(issue/24571): remove '!'. + event !: AnimationEvent; @HostBinding('@myAnimation2') exp: any = false; @@ -2747,7 +2756,8 @@ const DEFAULT_COMPONENT_ID = '1'; animations: [trigger('myAnimation', [])] }) class Cmp { - exp: string; + // TODO(issue/24571): remove '!'. + exp !: string; log: any[] = []; callback = (event: any) => this.log.push(`${event.phaseName} => ${event.toState}`); } @@ -2858,8 +2868,10 @@ const DEFAULT_COMPONENT_ID = '1'; }) class Cmp { log: string[] = []; - exp1: string; - exp2: string; + // TODO(issue/24571): remove '!'. + exp1 !: string; + // TODO(issue/24571): remove '!'. + exp2 !: string; cb(name: string, event: AnimationEvent) { this.log.push(name); } } @@ -2936,7 +2948,8 @@ const DEFAULT_COMPONENT_ID = '1'; class Cmp { log: string[] = []; events: {[name: string]: any} = {}; - exp: string; + // TODO(issue/24571): remove '!'. + exp !: string; items: any = [0, 1, 2, 3]; cb(name: string, phase: string, event: AnimationEvent) { @@ -3263,8 +3276,10 @@ const DEFAULT_COMPONENT_ID = '1'; class Cmp { disableExp = false; exp = ''; - startEvent: AnimationEvent; - doneEvent: AnimationEvent; + // TODO(issue/24571): remove '!'. + startEvent !: AnimationEvent; + // TODO(issue/24571): remove '!'. + doneEvent !: AnimationEvent; } TestBed.configureTestingModule({declarations: [Cmp]}); diff --git a/packages/core/test/animation/animation_query_integration_spec.ts b/packages/core/test/animation/animation_query_integration_spec.ts index 14278b3f81..a0d63325c4 100644 --- a/packages/core/test/animation/animation_query_integration_spec.ts +++ b/packages/core/test/animation/animation_query_integration_spec.ts @@ -1049,7 +1049,8 @@ import {fakeAsync, flushMicrotasks} from '../../testing/src/fake_async'; ])] }) class Cmp { - public items: any[]; + // TODO(issue/24571): remove '!'. + public items !: any[]; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -1129,7 +1130,8 @@ import {fakeAsync, flushMicrotasks} from '../../testing/src/fake_async'; }) class Cmp { public exp: any; - public items: any[]; + // TODO(issue/24571): remove '!'. + public items !: any[]; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -1349,7 +1351,8 @@ import {fakeAsync, flushMicrotasks} from '../../testing/src/fake_async'; }) class Cmp { public exp: any; - public items: any[]; + // TODO(issue/24571): remove '!'. + public items !: any[]; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -1401,7 +1404,8 @@ import {fakeAsync, flushMicrotasks} from '../../testing/src/fake_async'; }) class Cmp { public exp: any; - public items: any[]; + // TODO(issue/24571): remove '!'. + public items !: any[]; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -1463,7 +1467,8 @@ import {fakeAsync, flushMicrotasks} from '../../testing/src/fake_async'; class Cmp { public exp1: any; public exp2: any; - public items: any[]; + // TODO(issue/24571): remove '!'. + public items !: any[]; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -1532,7 +1537,8 @@ import {fakeAsync, flushMicrotasks} from '../../testing/src/fake_async'; }) class Cmp { public exp: any; - public items: any[]; + // TODO(issue/24571): remove '!'. + public items !: any[]; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -1586,7 +1592,8 @@ import {fakeAsync, flushMicrotasks} from '../../testing/src/fake_async'; }) class Cmp { public exp: any; - public items: any[]; + // TODO(issue/24571): remove '!'. + public items !: any[]; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -2469,7 +2476,8 @@ import {fakeAsync, flushMicrotasks} from '../../testing/src/fake_async'; ` }) class Cmp { - public exp: boolean; + // TODO(issue/24571): remove '!'. + public exp !: boolean; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -2648,7 +2656,8 @@ import {fakeAsync, flushMicrotasks} from '../../testing/src/fake_async'; ` }) class Cmp { - public exp: boolean; + // TODO(issue/24571): remove '!'. + public exp !: boolean; public log: string[] = []; callback(event: any) { this.log.push(event.element.getAttribute('data-name') + '-' + event.phaseName); diff --git a/packages/core/test/animation/animations_with_web_animations_integration_spec.ts b/packages/core/test/animation/animations_with_web_animations_integration_spec.ts index 6067815255..53bdd3cd59 100644 --- a/packages/core/test/animation/animations_with_web_animations_integration_spec.ts +++ b/packages/core/test/animation/animations_with_web_animations_integration_spec.ts @@ -138,7 +138,8 @@ import {TestBed} from '../../testing'; [transition('* => *', [style({height: '!'}), animate(1000, style({height: '*'}))])])] }) class Cmp { - public exp: number; + // TODO(issue/24571): remove '!'. + public exp !: number; public items = [0, 1, 2, 3, 4]; } @@ -358,7 +359,8 @@ import {TestBed} from '../../testing'; ] }) class Cmp { - public exp: string; + // TODO(issue/24571): remove '!'. + public exp !: string; } TestBed.configureTestingModule({declarations: [Cmp]}); @@ -411,7 +413,8 @@ import {TestBed} from '../../testing'; ] }) class Cmp { - public exp: string; + // TODO(issue/24571): remove '!'. + public exp !: string; public items: any[] = []; } diff --git a/packages/core/test/application_ref_spec.ts b/packages/core/test/application_ref_spec.ts index 8a225f1d9d..bdac3d0c1f 100644 --- a/packages/core/test/application_ref_spec.ts +++ b/packages/core/test/application_ref_spec.ts @@ -356,14 +356,16 @@ class SomeComponent { @Component({template: ''}) class ContainerComp { + // TODO(issue/24571): remove '!'. @ViewChild('vc', {read: ViewContainerRef}) - vc: ViewContainerRef; + vc !: ViewContainerRef; } @Component({template: 'Dynamic content'}) class EmbeddedViewComp { + // TODO(issue/24571): remove '!'. @ViewChild(TemplateRef) - tplRef: TemplateRef; + tplRef !: TemplateRef; } beforeEach(() => { diff --git a/packages/core/test/bundling/todo/index.ts b/packages/core/test/bundling/todo/index.ts index a2acf790be..2120f92677 100644 --- a/packages/core/test/bundling/todo/index.ts +++ b/packages/core/test/bundling/todo/index.ts @@ -14,7 +14,8 @@ import {Component, Injectable, IterableDiffers, NgModule, defineInjector, ɵNgOn export class Todo { editing: boolean; - private _title: string; + // TODO(issue/24571): remove '!'. + private _title !: string; get title() { return this._title; } set title(value: string) { this._title = value.trim(); } diff --git a/packages/core/test/debug/debug_node_spec.ts b/packages/core/test/debug/debug_node_spec.ts index bb73be6b3a..d608220a10 100644 --- a/packages/core/test/debug/debug_node_spec.ts +++ b/packages/core/test/debug/debug_node_spec.ts @@ -141,10 +141,13 @@ class LocalsComp { ` }) class BankAccount { - @Input() bank: string; - @Input('account') id: string; + // TODO(issue/24571): remove '!'. + @Input() bank !: string; + // TODO(issue/24571): remove '!'. + @Input('account') id !: string; - normalizedBankName: string; + // TODO(issue/24571): remove '!'. + normalizedBankName !: string; } @Component({ diff --git a/packages/core/test/forward_ref_integration_spec.ts b/packages/core/test/forward_ref_integration_spec.ts index 5c892aef0c..798870031c 100644 --- a/packages/core/test/forward_ref_integration_spec.ts +++ b/packages/core/test/forward_ref_integration_spec.ts @@ -46,7 +46,8 @@ class App { template: `{{frame.name}}({{lock.name}})`, }) class Door { - @ContentChildren(forwardRef(() => Lock)) locks: QueryList; + // TODO(issue/24571): remove '!'. + @ContentChildren(forwardRef(() => Lock)) locks !: QueryList; frame: Frame; constructor(@Inject(forwardRef(() => Frame)) frame: Frame) { this.frame = frame; } diff --git a/packages/core/test/linker/change_detection_integration_spec.ts b/packages/core/test/linker/change_detection_integration_spec.ts index 01095e0541..2a4f42deb4 100644 --- a/packages/core/test/linker/change_detection_integration_spec.ts +++ b/packages/core/test/linker/change_detection_integration_spec.ts @@ -1310,8 +1310,10 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [ @Component({template: '{{name}}'}) class Comp { name = 'Tom'; - @ViewChild('vc', {read: ViewContainerRef}) vc: ViewContainerRef; - @ViewChild(TemplateRef) template: TemplateRef; + // TODO(issue/24571): remove '!'. + @ViewChild('vc', {read: ViewContainerRef}) vc !: ViewContainerRef; + // TODO(issue/24571): remove '!'. + @ViewChild(TemplateRef) template !: TemplateRef; } TestBed.configureTestingModule({declarations: [Comp]}); @@ -1351,8 +1353,9 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [ `` }) class OuterComp { + // TODO(issue/24571): remove '!'. @ContentChild(TemplateRef) - tpl: TemplateRef; + tpl !: TemplateRef; constructor(public cdRef: ChangeDetectorRef) {} log(id: string) { log.push(`outer-${id}`); } @@ -1364,11 +1367,13 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [ `>` }) class InnerComp { + // TODO(issue/24571): remove '!'. @ContentChild(TemplateRef) - tpl: TemplateRef; + tpl !: TemplateRef; + // TODO(issue/24571): remove '!'. @Input() - outerTpl: TemplateRef; + outerTpl !: TemplateRef; constructor(public cdRef: ChangeDetectorRef) {} log(id: string) { log.push(`inner-${id}`); } @@ -1517,7 +1522,8 @@ const TEST_COMPILER_PROVIDERS: Provider[] = [ class MyChild { private thrown = LifetimeMethods.None; - @Input() inp: boolean; + // TODO(issue/24571): remove '!'. + @Input() inp !: boolean; @Output() outp = new EventEmitter(); constructor() {} @@ -1793,13 +1799,16 @@ class TestDirective implements OnInit, DoCheck, OnChanges, AfterContentInit, Aft AfterViewInit, AfterViewChecked, OnDestroy { @Input() a: any; @Input() b: any; - changes: SimpleChanges; + // TODO(issue/24571): remove '!'. + changes !: SimpleChanges; event: any; eventEmitter: EventEmitter = new EventEmitter(); - @Input('testDirective') name: string; + // TODO(issue/24571): remove '!'. + @Input('testDirective') name !: string; - @Input() throwOn: string; + // TODO(issue/24571): remove '!'. + @Input() throwOn !: string; constructor(public log: DirectiveLog) {} @@ -1875,7 +1884,8 @@ class OnDestroyDirective implements OnDestroy { @Directive({selector: '[orderCheck0]'}) class OrderCheckDirective0 { - private _name: string; + // TODO(issue/24571): remove '!'. + private _name !: string; @Input('orderCheck0') set name(value: string) { @@ -1888,7 +1898,8 @@ class OrderCheckDirective0 { @Directive({selector: '[orderCheck1]'}) class OrderCheckDirective1 { - private _name: string; + // TODO(issue/24571): remove '!'. + private _name !: string; @Input('orderCheck1') set name(value: string) { @@ -1901,7 +1912,8 @@ class OrderCheckDirective1 { @Directive({selector: '[orderCheck2]'}) class OrderCheckDirective2 { - private _name: string; + // TODO(issue/24571): remove '!'. + private _name !: string; @Input('orderCheck2') set name(value: string) { @@ -1925,10 +1937,13 @@ class TestLocals { @Component({selector: 'root', template: 'empty'}) class Person { - age: number; - name: string; + // TODO(issue/24571): remove '!'. + age !: number; + // TODO(issue/24571): remove '!'. + name !: string; address: Address|null = null; - phones: number[]; + // TODO(issue/24571): remove '!'. + phones !: number[]; init(name: string, address: Address|null = null) { this.name = name; @@ -1982,13 +1997,15 @@ class TestData { @Component({selector: 'root', template: 'empty'}) class TestDataWithGetter { - public fn: Function; + // TODO(issue/24571): remove '!'. + public fn !: Function; get a() { return this.fn(); } } class Holder { - value: T; + // TODO(issue/24571): remove '!'. + value !: T; } @Component({selector: 'root', template: 'empty'}) diff --git a/packages/core/test/linker/integration_spec.ts b/packages/core/test/linker/integration_spec.ts index 027a36f9f1..7ceff4a8c0 100644 --- a/packages/core/test/linker/integration_spec.ts +++ b/packages/core/test/linker/integration_spec.ts @@ -939,7 +939,8 @@ function declareTests({useJit}: {useJit: boolean}) { @Directive({selector: '[host-listener]', host: {'(click)': 'doIt(id, unknownProp)'}}) class DirectiveWithHostListener { id = 'one'; - receivedArgs: any[]; + // TODO(issue/24571): remove '!'. + receivedArgs !: any[]; doIt(...args: any[]) { this.receivedArgs = args; } } @@ -1956,12 +1957,14 @@ class MyDir { @Directive({selector: '[title]', inputs: ['title']}) class DirectiveWithTitle { - title: string; + // TODO(issue/24571): remove '!'. + title !: string; } @Directive({selector: '[title]', inputs: ['title'], host: {'[title]': 'title'}}) class DirectiveWithTitleAndHostProperty { - title: string; + // TODO(issue/24571): remove '!'. + title !: string; } @Component({selector: 'event-cmp', template: '
'}) @@ -2032,7 +2035,8 @@ class PushCmpWithHostEvent { }) class PushCmpWithAsyncPipe { numberOfChecks: number = 0; - resolve: (result: any) => void; + // TODO(issue/24571): remove '!'. + resolve !: (result: any) => void; promise: Promise; constructor() { @@ -2218,7 +2222,8 @@ class DirectiveListeningDomEventNoPrevent { @Directive({selector: '[id]', inputs: ['id']}) class IdDir { - id: string; + // TODO(issue/24571): remove '!'. + id !: string; } @Directive({selector: '[customEvent]'}) @@ -2281,7 +2286,8 @@ class ToolbarViewContainer { template: 'TOOLBAR(
)', }) class ToolbarComponent { - @ContentChildren(ToolbarPart) query: QueryList; + // TODO(issue/24571): remove '!'. + @ContentChildren(ToolbarPart) query !: QueryList; ctxProp: string = 'hello world'; constructor() {} @@ -2481,10 +2487,12 @@ class ComponentWithTemplate { class DirectiveWithPropDecorators { target: any; - @Input('elProp') dirProp: string; + // TODO(issue/24571): remove '!'. + @Input('elProp') dirProp !: string; @Output('elEvent') event = new EventEmitter(); - @HostBinding('attr.my-attr') myAttr: string; + // TODO(issue/24571): remove '!'. + @HostBinding('attr.my-attr') myAttr !: string; @HostListener('click', ['$event.target']) onClick(target: any) { this.target = target; } diff --git a/packages/core/test/linker/ng_container_integration_spec.ts b/packages/core/test/linker/ng_container_integration_spec.ts index 743478ea0c..654c163f3e 100644 --- a/packages/core/test/linker/ng_container_integration_spec.ts +++ b/packages/core/test/linker/ng_container_integration_spec.ts @@ -161,16 +161,20 @@ class TextDirective { @Component({selector: 'needs-content-children', template: ''}) class NeedsContentChildren implements AfterContentInit { - @ContentChildren(TextDirective) textDirChildren: QueryList; - numberOfChildrenAfterContentInit: number; + // TODO(issue/24571): remove '!'. + @ContentChildren(TextDirective) textDirChildren !: QueryList; + // TODO(issue/24571): remove '!'. + numberOfChildrenAfterContentInit !: number; ngAfterContentInit() { this.numberOfChildrenAfterContentInit = this.textDirChildren.length; } } @Component({selector: 'needs-view-children', template: '
'}) class NeedsViewChildren implements AfterViewInit { - @ViewChildren(TextDirective) textDirChildren: QueryList; - numberOfChildrenAfterViewInit: number; + // TODO(issue/24571): remove '!'. + @ViewChildren(TextDirective) textDirChildren !: QueryList; + // TODO(issue/24571): remove '!'. + numberOfChildrenAfterViewInit !: number; ngAfterViewInit() { this.numberOfChildrenAfterViewInit = this.textDirChildren.length; } } diff --git a/packages/core/test/linker/ng_module_integration_spec.ts b/packages/core/test/linker/ng_module_integration_spec.ts index 0ef56663cb..2f7665c320 100644 --- a/packages/core/test/linker/ng_module_integration_spec.ts +++ b/packages/core/test/linker/ng_module_integration_spec.ts @@ -55,7 +55,8 @@ class CarWithDashboard { @Injectable() class SportsCar extends Car { - engine: Engine; + // TODO(issue/24571): remove '!'. + engine !: Engine; constructor(engine: Engine) { super(engine); } } @@ -82,8 +83,9 @@ class SomeComp { @Directive({selector: '[someDir]'}) class SomeDirective { + // TODO(issue/24571): remove '!'. @HostBinding('title') @Input() - someDir: string; + someDir !: string; } @Pipe({name: 'somePipe'}) diff --git a/packages/core/test/linker/query_integration_spec.ts b/packages/core/test/linker/query_integration_spec.ts index bf11d8aa9b..9e8cbc72a2 100644 --- a/packages/core/test/linker/query_integration_spec.ts +++ b/packages/core/test/linker/query_integration_spec.ts @@ -614,11 +614,13 @@ import {stringify} from '../../src/util'; @Component( {selector: 'auto-projecting', template: '
'}) class AutoProjecting { + // TODO(issue/24571): remove '!'. @ContentChild(TemplateRef) - content: TemplateRef; + content !: TemplateRef; + // TODO(issue/24571): remove '!'. @ContentChildren(TextDirective) - query: QueryList; + query !: QueryList; } TestBed.configureTestingModule({declarations: [AutoProjecting]}); @@ -638,22 +640,27 @@ import {stringify} from '../../src/util'; @Directive({selector: '[text]', inputs: ['text'], exportAs: 'textDir'}) class TextDirective { - text: string; + // TODO(issue/24571): remove '!'. + text !: string; constructor() {} } @Component({selector: 'needs-content-children', template: ''}) class NeedsContentChildren implements AfterContentInit { - @ContentChildren(TextDirective) textDirChildren: QueryList; - numberOfChildrenAfterContentInit: number; + // TODO(issue/24571): remove '!'. + @ContentChildren(TextDirective) textDirChildren !: QueryList; + // TODO(issue/24571): remove '!'. + numberOfChildrenAfterContentInit !: number; ngAfterContentInit() { this.numberOfChildrenAfterContentInit = this.textDirChildren.length; } } @Component({selector: 'needs-view-children', template: '
'}) class NeedsViewChildren implements AfterViewInit { - @ViewChildren(TextDirective) textDirChildren: QueryList; - numberOfChildrenAfterViewInit: number; + // TODO(issue/24571): remove '!'. + @ViewChildren(TextDirective) textDirChildren !: QueryList; + // TODO(issue/24571): remove '!'. + numberOfChildrenAfterViewInit !: number; ngAfterViewInit() { this.numberOfChildrenAfterViewInit = this.textDirChildren.length; } } @@ -661,7 +668,8 @@ class NeedsViewChildren implements AfterViewInit { @Component({selector: 'needs-content-child', template: ''}) class NeedsContentChild implements AfterContentInit, AfterContentChecked { /** @internal */ - _child: TextDirective; + // TODO(issue/24571): remove '!'. + _child !: TextDirective; @ContentChild(TextDirective) set child(value) { @@ -679,7 +687,8 @@ class NeedsContentChild implements AfterContentInit, AfterContentChecked { @Directive({selector: '[directive-needs-content-child]'}) class DirectiveNeedsContentChild { - @ContentChild(TextDirective) child: TextDirective; + // TODO(issue/24571): remove '!'. + @ContentChild(TextDirective) child !: TextDirective; } @Component({selector: 'needs-view-child', template: `
`}) @@ -687,7 +696,8 @@ class NeedsViewChild implements AfterViewInit, AfterViewChecked { shouldShow: boolean = true; shouldShow2: boolean = false; /** @internal */ - _child: TextDirective; + // TODO(issue/24571): remove '!'. + _child !: TextDirective; @ViewChild(TextDirective) set child(value) { @@ -717,8 +727,10 @@ function createTestCmpAndDetectChanges(type: Type, template: string): Comp @Component({selector: 'needs-static-content-view-child', template: `
`}) class NeedsStaticContentAndViewChild { - @ContentChild(TextDirective) contentChild: TextDirective; - @ViewChild(TextDirective) viewChild: TextDirective; + // TODO(issue/24571): remove '!'. + @ContentChild(TextDirective) contentChild !: TextDirective; + // TODO(issue/24571): remove '!'. + @ViewChild(TextDirective) viewChild !: TextDirective; } @Directive({selector: '[dir]'}) @@ -730,15 +742,20 @@ class InertDirective { template: '
{{dir.text}}|' }) class NeedsQuery { - @ContentChildren(TextDirective) query: QueryList; + // TODO(issue/24571): remove '!'. + @ContentChildren(TextDirective) query !: QueryList; } @Component({selector: 'needs-four-queries', template: ''}) class NeedsFourQueries { - @ContentChild(TextDirective) query1: TextDirective; - @ContentChild(TextDirective) query2: TextDirective; - @ContentChild(TextDirective) query3: TextDirective; - @ContentChild(TextDirective) query4: TextDirective; + // TODO(issue/24571): remove '!'. + @ContentChild(TextDirective) query1 !: TextDirective; + // TODO(issue/24571): remove '!'. + @ContentChild(TextDirective) query2 !: TextDirective; + // TODO(issue/24571): remove '!'. + @ContentChild(TextDirective) query3 !: TextDirective; + // TODO(issue/24571): remove '!'. + @ContentChild(TextDirective) query4 !: TextDirective; } @Component({ @@ -746,22 +763,26 @@ class NeedsFourQueries { template: '
{{dir.text}}|
' }) class NeedsQueryDesc { - @ContentChildren(TextDirective, {descendants: true}) query: QueryList; + // TODO(issue/24571): remove '!'. + @ContentChildren(TextDirective, {descendants: true}) query !: QueryList; } @Component({selector: 'needs-query-by-ref-binding', template: ''}) class NeedsQueryByLabel { - @ContentChildren('textLabel', {descendants: true}) query: QueryList; + // TODO(issue/24571): remove '!'. + @ContentChildren('textLabel', {descendants: true}) query !: QueryList; } @Component({selector: 'needs-view-query-by-ref-binding', template: '
text
'}) class NeedsViewQueryByLabel { - @ViewChildren('textLabel') query: QueryList; + // TODO(issue/24571): remove '!'. + @ViewChildren('textLabel') query !: QueryList; } @Component({selector: 'needs-query-by-ref-bindings', template: ''}) class NeedsQueryByTwoLabels { - @ContentChildren('textLabel1,textLabel2', {descendants: true}) query: QueryList; + // TODO(issue/24571): remove '!'. + @ContentChildren('textLabel1,textLabel2', {descendants: true}) query !: QueryList; } @Component({ @@ -769,7 +790,8 @@ class NeedsQueryByTwoLabels { template: '
{{dir.text}}|
' }) class NeedsQueryAndProject { - @ContentChildren(TextDirective) query: QueryList; + // TODO(issue/24571): remove '!'. + @ContentChildren(TextDirective) query !: QueryList; } @Component({ @@ -777,13 +799,15 @@ class NeedsQueryAndProject { template: '
' }) class NeedsViewQuery { - @ViewChildren(TextDirective) query: QueryList; + // TODO(issue/24571): remove '!'. + @ViewChildren(TextDirective) query !: QueryList; } @Component({selector: 'needs-view-query-if', template: '
'}) class NeedsViewQueryIf { show: boolean = false; - @ViewChildren(TextDirective) query: QueryList; + // TODO(issue/24571): remove '!'. + @ViewChildren(TextDirective) query !: QueryList; } @Component({ @@ -792,7 +816,8 @@ class NeedsViewQueryIf { }) class NeedsViewQueryNestedIf { show: boolean = true; - @ViewChildren(TextDirective) query: QueryList; + // TODO(issue/24571): remove '!'. + @ViewChildren(TextDirective) query !: QueryList; } @Component({ @@ -802,7 +827,8 @@ class NeedsViewQueryNestedIf { '
' }) class NeedsViewQueryOrder { - @ViewChildren(TextDirective) query: QueryList; + // TODO(issue/24571): remove '!'. + @ViewChildren(TextDirective) query !: QueryList; list: string[] = ['2', '3']; } @@ -813,35 +839,44 @@ class NeedsViewQueryOrder { '
' }) class NeedsViewQueryOrderWithParent { - @ViewChildren(TextDirective) query: QueryList; + // TODO(issue/24571): remove '!'. + @ViewChildren(TextDirective) query !: QueryList; list: string[] = ['2', '3']; } @Component({selector: 'needs-tpl', template: '
shadow
'}) class NeedsTpl { - @ViewChildren(TemplateRef) viewQuery: QueryList>; - @ContentChildren(TemplateRef) query: QueryList>; + // TODO(issue/24571): remove '!'. + @ViewChildren(TemplateRef) viewQuery !: QueryList>; + // TODO(issue/24571): remove '!'. + @ContentChildren(TemplateRef) query !: QueryList>; constructor(public vc: ViewContainerRef) {} } @Component( {selector: 'needs-named-tpl', template: '
shadow
'}) class NeedsNamedTpl { - @ViewChild('tpl') viewTpl: TemplateRef; - @ContentChild('tpl') contentTpl: TemplateRef; + // TODO(issue/24571): remove '!'. + @ViewChild('tpl') viewTpl !: TemplateRef; + // TODO(issue/24571): remove '!'. + @ContentChild('tpl') contentTpl !: TemplateRef; constructor(public vc: ViewContainerRef) {} } @Component({selector: 'needs-content-children-read', template: ''}) class NeedsContentChildrenWithRead { - @ContentChildren('q', {read: TextDirective}) textDirChildren: QueryList; - @ContentChildren('nonExisting', {read: TextDirective}) nonExistingVar: QueryList; + // TODO(issue/24571): remove '!'. + @ContentChildren('q', {read: TextDirective}) textDirChildren !: QueryList; + // TODO(issue/24571): remove '!'. + @ContentChildren('nonExisting', {read: TextDirective}) nonExistingVar !: QueryList; } @Component({selector: 'needs-content-child-read', template: ''}) class NeedsContentChildWithRead { - @ContentChild('q', {read: TextDirective}) textDirChild: TextDirective; - @ContentChild('nonExisting', {read: TextDirective}) nonExistingVar: TextDirective; + // TODO(issue/24571): remove '!'. + @ContentChild('q', {read: TextDirective}) textDirChild !: TextDirective; + // TODO(issue/24571): remove '!'. + @ContentChild('nonExisting', {read: TextDirective}) nonExistingVar !: TextDirective; } @Component({ @@ -849,7 +884,8 @@ class NeedsContentChildWithRead { template: '
' }) class NeedsContentChildTemplateRef { - @ContentChild(TemplateRef) templateRef: TemplateRef; + // TODO(issue/24571): remove '!'. + @ContentChild(TemplateRef) templateRef !: TemplateRef; } @Component({ @@ -866,8 +902,10 @@ class NeedsContentChildTemplateRefApp { template: '
', }) class NeedsViewChildrenWithRead { - @ViewChildren('q,w', {read: TextDirective}) textDirChildren: QueryList; - @ViewChildren('nonExisting', {read: TextDirective}) nonExistingVar: QueryList; + // TODO(issue/24571): remove '!'. + @ViewChildren('q,w', {read: TextDirective}) textDirChildren !: QueryList; + // TODO(issue/24571): remove '!'. + @ViewChildren('nonExisting', {read: TextDirective}) nonExistingVar !: QueryList; } @Component({ @@ -875,15 +913,20 @@ class NeedsViewChildrenWithRead { template: '
', }) class NeedsViewChildWithRead { - @ViewChild('q', {read: TextDirective}) textDirChild: TextDirective; - @ViewChild('nonExisting', {read: TextDirective}) nonExistingVar: TextDirective; + // TODO(issue/24571): remove '!'. + @ViewChild('q', {read: TextDirective}) textDirChild !: TextDirective; + // TODO(issue/24571): remove '!'. + @ViewChild('nonExisting', {read: TextDirective}) nonExistingVar !: TextDirective; } @Component({selector: 'needs-viewcontainer-read', template: '
'}) class NeedsViewContainerWithRead { - @ViewChild('q', {read: ViewContainerRef}) vc: ViewContainerRef; - @ViewChild('nonExisting', {read: ViewContainerRef}) nonExistingVar: ViewContainerRef; - @ContentChild(TemplateRef) template: TemplateRef; + // TODO(issue/24571): remove '!'. + @ViewChild('q', {read: ViewContainerRef}) vc !: ViewContainerRef; + // TODO(issue/24571): remove '!'. + @ViewChild('nonExisting', {read: ViewContainerRef}) nonExistingVar !: ViewContainerRef; + // TODO(issue/24571): remove '!'. + @ContentChild(TemplateRef) template !: TemplateRef; createView() { this.vc.createEmbeddedView(this.template); } } @@ -905,13 +948,16 @@ class MyCompBroken0 { @Component({selector: 'manual-projecting', template: '
'}) class ManualProjecting { - @ContentChild(TemplateRef) template: TemplateRef; + // TODO(issue/24571): remove '!'. + @ContentChild(TemplateRef) template !: TemplateRef; + // TODO(issue/24571): remove '!'. @ViewChild('vc', {read: ViewContainerRef}) - vc: ViewContainerRef; + vc !: ViewContainerRef; + // TODO(issue/24571): remove '!'. @ContentChildren(TextDirective) - query: QueryList; + query !: QueryList; create() { this.vc.createEmbeddedView(this.template); } diff --git a/packages/core/test/linker/regression_integration_spec.ts b/packages/core/test/linker/regression_integration_spec.ts index a4b37cdfaa..7fa02970ee 100644 --- a/packages/core/test/linker/regression_integration_spec.ts +++ b/packages/core/test/linker/regression_integration_spec.ts @@ -81,7 +81,8 @@ function declareTests({useJit}: {useJit: boolean}) { @Directive({selector: '[myDir]'}) class MyDir { setterCalls: {[key: string]: any} = {}; - changes: SimpleChanges; + // TODO(issue/24571): remove '!'. + changes !: SimpleChanges; @Input() set a(v: number) { this.setterCalls['a'] = v; } @@ -124,7 +125,8 @@ function declareTests({useJit}: {useJit: boolean}) { it('should evaluate a conditional in a statement binding', () => { @Component({selector: 'some-comp', template: '

'}) class SomeComponent { - nullValue: SomeReferencedClass; + // TODO(issue/24571): remove '!'. + nullValue !: SomeReferencedClass; } class SomeReferencedClass { @@ -272,7 +274,8 @@ function declareTests({useJit}: {useJit: boolean}) { @Directive({selector: '[someDir]'}) class MyDir { - @Input('someDir') template: TemplateRef; + // TODO(issue/24571): remove '!'. + @Input('someDir') template !: TemplateRef; } const ctx = @@ -292,8 +295,9 @@ function declareTests({useJit}: {useJit: boolean}) { it('should not recreate ViewContainerRefs in queries', () => { @Component({template: '
'}) class MyComp { + // TODO(issue/24571): remove '!'. @ViewChildren('vc', {read: ViewContainerRef}) - viewContainers: QueryList; + viewContainers !: QueryList; show = true; } @@ -344,7 +348,8 @@ function declareTests({useJit}: {useJit: boolean}) { it('should support @ContentChild and @Input on the same property for static queries', () => { @Directive({selector: 'test'}) class Test { - @Input() @ContentChild(TemplateRef) tpl: TemplateRef; + // TODO(issue/24571): remove '!'. + @Input() @ContentChild(TemplateRef) tpl !: TemplateRef; } @Component({ diff --git a/packages/core/test/linker/security_integration_spec.ts b/packages/core/test/linker/security_integration_spec.ts index fc8396ef2c..dede02e5a1 100644 --- a/packages/core/test/linker/security_integration_spec.ts +++ b/packages/core/test/linker/security_integration_spec.ts @@ -168,8 +168,9 @@ function declareTests({useJit}: {useJit: boolean}) { it('should escape unsafe properties if they are used in host bindings', () => { @Directive({selector: '[dirHref]'}) class HrefDirective { + // TODO(issue/24571): remove '!'. @HostBinding('href') @Input() - dirHref: string; + dirHref !: string; } const template = `Link Title`; @@ -183,8 +184,9 @@ function declareTests({useJit}: {useJit: boolean}) { it('should escape unsafe attributes if they are used in host bindings', () => { @Directive({selector: '[dirHref]'}) class HrefDirective { + // TODO(issue/24571): remove '!'. @HostBinding('attr.href') @Input() - dirHref: string; + dirHref !: string; } const template = `Link Title`; diff --git a/packages/core/test/metadata/di_spec.ts b/packages/core/test/metadata/di_spec.ts index c42b6135ad..733328e53c 100644 --- a/packages/core/test/metadata/di_spec.ts +++ b/packages/core/test/metadata/di_spec.ts @@ -76,26 +76,31 @@ import {TestBed} from '@angular/core/testing'; @Directive({selector: 'simple'}) class Simple { - @Input() marker: string; + // TODO(issue/24571): remove '!'. + @Input() marker !: string; } @Component({selector: 'view-child-type-selector', template: ''}) class ViewChildTypeSelectorComponent { - @ViewChild(Simple) child: Simple; + // TODO(issue/24571): remove '!'. + @ViewChild(Simple) child !: Simple; } @Component({selector: 'view-child-string-selector', template: ''}) class ViewChildStringSelectorComponent { - @ViewChild('child') child: ElementRef; + // TODO(issue/24571): remove '!'. + @ViewChild('child') child !: ElementRef; } @Component({selector: 'view-children-type-selector', template: ''}) class ViewChildrenTypeSelectorComponent { - @ViewChildren(Simple) children: QueryList; + // TODO(issue/24571): remove '!'. + @ViewChildren(Simple) children !: QueryList; } @Component({selector: 'view-child-string-selector', template: ''}) class ViewChildrenStringSelectorComponent { // Allow comma separated selector (with spaces). - @ViewChildren('child1 , child2') children: QueryList; + // TODO(issue/24571): remove '!'. + @ViewChildren('child1 , child2') children !: QueryList; } diff --git a/packages/core/test/reflection/reflector_spec.ts b/packages/core/test/reflection/reflector_spec.ts index 291a74a815..a5f022cb24 100644 --- a/packages/core/test/reflection/reflector_spec.ts +++ b/packages/core/test/reflection/reflector_spec.ts @@ -329,17 +329,21 @@ class TestObj { class C {} class Parent { + // TODO(issue/24571): remove '!'. @PropDecorator('a') - a: A; + a !: A; + // TODO(issue/24571): remove '!'. @PropDecorator('b1') - b: B; + b !: B; } class Child extends Parent { + // TODO(issue/24571): remove '!'. @PropDecorator('b2') - b: B; + b !: B; + // TODO(issue/24571): remove '!'. @PropDecorator('c') - c: C; + c !: C; } class NoDecorators {} diff --git a/packages/core/test/render3/change_detection_spec.ts b/packages/core/test/render3/change_detection_spec.ts index 5fcbc3c016..dd694d4430 100644 --- a/packages/core/test/render3/change_detection_spec.ts +++ b/packages/core/test/render3/change_detection_spec.ts @@ -676,7 +676,8 @@ describe('change detection', () => { class OnPushComp { /** @Input() */ - value: string; + // TODO(issue/24571): remove '!'. + value !: string; constructor(public cdr: ChangeDetectorRef) {} diff --git a/packages/core/test/render3/compiler_canonical/component_directives_spec.ts b/packages/core/test/render3/compiler_canonical/component_directives_spec.ts index 90cd8ce01c..8667fd53dc 100644 --- a/packages/core/test/render3/compiler_canonical/component_directives_spec.ts +++ b/packages/core/test/render3/compiler_canonical/component_directives_spec.ts @@ -292,7 +292,8 @@ describe('components & directives', () => { changeDetection: ChangeDetectionStrategy.OnPush }) class MyComp { - @Input() name: string; + // TODO(issue/24571): remove '!'. + @Input() name !: string; // NORMATIVE static ngComponentDef = $r3$.ɵdefineComponent({ @@ -416,7 +417,8 @@ describe('components & directives', () => { ` }) class MyArrayComp { - @Input() names: string[]; + // TODO(issue/24571): remove '!'. + @Input() names !: string[]; static ngComponentDef = $r3$.ɵdefineComponent({ type: MyArrayComp, @@ -524,7 +526,8 @@ describe('components & directives', () => { @Component({selector: 'my-comp', template: `{{ num }}`}) class MyComp { - num: number; + // TODO(issue/24571): remove '!'. + num !: number; static ngComponentDef = $r3$.ɵdefineComponent({ type: MyComp, @@ -646,7 +649,8 @@ describe('components & directives', () => { ` }) class MyComp { - @Input() names: string[]; + // TODO(issue/24571): remove '!'. + @Input() names !: string[]; static ngComponentDef = $r3$.ɵdefineComponent({ type: MyComp, @@ -751,7 +755,8 @@ describe('components & directives', () => { ` }) class ObjectComp { - config: {[key: string]: any}; + // TODO(issue/24571): remove '!'. + config !: {[key: string]: any}; static ngComponentDef = $r3$.ɵdefineComponent({ type: ObjectComp, @@ -827,7 +832,8 @@ describe('components & directives', () => { ` }) class NestedComp { - config: {[key: string]: any}; + // TODO(issue/24571): remove '!'. + config !: {[key: string]: any}; static ngComponentDef = $r3$.ɵdefineComponent({ type: NestedComp, diff --git a/packages/core/test/render3/compiler_canonical/life_cycle_spec.ts b/packages/core/test/render3/compiler_canonical/life_cycle_spec.ts index 6738ee94e0..f8cedef8ed 100644 --- a/packages/core/test/render3/compiler_canonical/life_cycle_spec.ts +++ b/packages/core/test/render3/compiler_canonical/life_cycle_spec.ts @@ -25,7 +25,8 @@ describe('lifecycle hooks', () => { @Component({selector: 'lifecycle-comp', template: ``}) class LifecycleComp { - @Input('name') nameMin: string; + // TODO(issue/24571): remove '!'. + @Input('name') nameMin !: string; ngOnChanges() { events.push('changes' + this.nameMin); } diff --git a/packages/core/test/render3/compiler_canonical/query_spec.ts b/packages/core/test/render3/compiler_canonical/query_spec.ts index 4861072624..3946badeb4 100644 --- a/packages/core/test/render3/compiler_canonical/query_spec.ts +++ b/packages/core/test/render3/compiler_canonical/query_spec.ts @@ -44,8 +44,10 @@ describe('queries', () => { ` }) class ViewQueryComponent { - @ViewChild(SomeDirective) someDir: SomeDirective; - @ViewChildren(SomeDirective) someDirList: QueryList; + // TODO(issue/24571): remove '!'. + @ViewChild(SomeDirective) someDir !: SomeDirective; + // TODO(issue/24571): remove '!'. + @ViewChildren(SomeDirective) someDirList !: QueryList; // NORMATIVE static ngComponentDef = $r3$.ɵdefineComponent({ @@ -97,8 +99,10 @@ describe('queries', () => { ` }) class ContentQueryComponent { - @ContentChild(SomeDirective) someDir: SomeDirective; - @ContentChildren(SomeDirective) someDirList: QueryList; + // TODO(issue/24571): remove '!'. + @ContentChild(SomeDirective) someDir !: SomeDirective; + // TODO(issue/24571): remove '!'. + @ContentChildren(SomeDirective) someDirList !: QueryList; // NORMATIVE static ngComponentDef = $r3$.ɵdefineComponent({ diff --git a/packages/core/test/render3/compiler_canonical/template_variables_spec.ts b/packages/core/test/render3/compiler_canonical/template_variables_spec.ts index 8f57e5d805..0633142d6b 100644 --- a/packages/core/test/render3/compiler_canonical/template_variables_spec.ts +++ b/packages/core/test/render3/compiler_canonical/template_variables_spec.ts @@ -27,11 +27,13 @@ describe('template variables', () => { @Directive({selector: '[forOf]'}) class ForOfDirective { - private previous: any[]; + // TODO(issue/24571): remove '!'. + private previous !: any[]; constructor(private view: ViewContainerRef, private template: TemplateRef) {} - @Input() forOf: any[]; + // TODO(issue/24571): remove '!'. + @Input() forOf !: any[]; ngOnChanges(simpleChanges: SimpleChanges) { if ('forOf' in simpleChanges) { diff --git a/packages/core/test/render3/component_spec.ts b/packages/core/test/render3/component_spec.ts index c73fc4c0f6..49a1e13857 100644 --- a/packages/core/test/render3/component_spec.ts +++ b/packages/core/test/render3/component_spec.ts @@ -130,7 +130,8 @@ describe('component with a container', () => { } class WrapperComponent { - items: string[]; + // TODO(issue/24571): remove '!'. + items !: string[]; static ngComponentDef = defineComponent({ type: WrapperComponent, selectors: [['wrapper']], @@ -367,7 +368,8 @@ describe('recursive components', () => { it('should map inputs minified & unminified names', async() => { class TestInputsComponent { - minifiedName: string; + // TODO(issue/24571): remove '!'. + minifiedName !: string; static ngComponentDef = defineComponent({ type: TestInputsComponent, selectors: [['test-inputs']], diff --git a/packages/core/test/render3/define_spec.ts b/packages/core/test/render3/define_spec.ts index 165895866d..bd4d2bbac3 100644 --- a/packages/core/test/render3/define_spec.ts +++ b/packages/core/test/render3/define_spec.ts @@ -54,7 +54,8 @@ describe('define', () => { class MyDirective implements OnChanges { public log: Array = []; public valA: string = 'initValue'; - public valB: string; + // TODO(issue/24571): remove '!'. + public valB !: string; ngOnChanges(changes: SimpleChanges): void { this.log.push('valA', changes['valA']); diff --git a/packages/core/test/render3/di_spec.ts b/packages/core/test/render3/di_spec.ts index e910548115..96e34f7cdc 100644 --- a/packages/core/test/render3/di_spec.ts +++ b/packages/core/test/render3/di_spec.ts @@ -556,7 +556,8 @@ describe('di', () => { describe('flags', () => { class DirB { - value: string; + // TODO(issue/24571): remove '!'. + value !: string; static ngDirectiveDef = defineDirective({ type: DirB, diff --git a/packages/core/test/render3/directive_spec.ts b/packages/core/test/render3/directive_spec.ts index a84c9008b9..344105e3d4 100644 --- a/packages/core/test/render3/directive_spec.ts +++ b/packages/core/test/render3/directive_spec.ts @@ -61,8 +61,10 @@ describe('directive', () => { inputs: {test: 'test', other: 'other'} }); - testValue: boolean; - other: boolean; + // TODO(issue/24571): remove '!'. + testValue !: boolean; + // TODO(issue/24571): remove '!'. + other !: boolean; /** * A setter to assert that a binding is not invoked with stringified attribute value @@ -108,9 +110,12 @@ describe('directive', () => { inputs: {test: 'test', prop1: 'prop1', prop2: 'prop2'} }); - prop1: boolean; - prop2: boolean; - testValue: boolean; + // TODO(issue/24571): remove '!'. + prop1 !: boolean; + // TODO(issue/24571): remove '!'. + prop2 !: boolean; + // TODO(issue/24571): remove '!'. + testValue !: boolean; /** diff --git a/packages/core/test/render3/exports_spec.ts b/packages/core/test/render3/exports_spec.ts index 0ff071c707..824b76e6c6 100644 --- a/packages/core/test/render3/exports_spec.ts +++ b/packages/core/test/render3/exports_spec.ts @@ -76,7 +76,8 @@ describe('exports', () => { } class MyDir { - myDir: MyComponent; + // TODO(issue/24571): remove '!'. + myDir !: MyComponent; constructor() { myDir = this; } static ngDirectiveDef = defineDirective({ type: MyDir, @@ -242,7 +243,8 @@ describe('exports', () => { } class MyDir { - myDir: MyComponent; + // TODO(issue/24571): remove '!'. + myDir !: MyComponent; constructor() { myDir = this; } diff --git a/packages/core/test/render3/instructions_spec.ts b/packages/core/test/render3/instructions_spec.ts index 50d643dc28..48a6bcb652 100644 --- a/packages/core/test/render3/instructions_spec.ts +++ b/packages/core/test/render3/instructions_spec.ts @@ -459,7 +459,8 @@ class LocalSanitizedValue { } class LocalMockSanitizer implements Sanitizer { - public lastSanitizedValue: string|null; + // TODO(issue/24571): remove '!'. + public lastSanitizedValue !: string | null; constructor(private _interceptor: (value: string|null|any) => string) {} diff --git a/packages/core/test/render3/integration_spec.ts b/packages/core/test/render3/integration_spec.ts index 37e0729b91..7307ab49a7 100644 --- a/packages/core/test/render3/integration_spec.ts +++ b/packages/core/test/render3/integration_spec.ts @@ -375,7 +375,8 @@ describe('render3 integration test', () => { * % } */ class MyComp { - condition: boolean; + // TODO(issue/24571): remove '!'. + condition !: boolean; static ngComponentDef = defineComponent({ type: MyComp, selectors: [['comp']], @@ -491,8 +492,10 @@ describe('render3 integration test', () => { } class ChildComponent { - beforeTree: Tree; - afterTree: Tree; + // TODO(issue/24571): remove '!'. + beforeTree !: Tree; + // TODO(issue/24571): remove '!'. + afterTree !: Tree; static ngComponentDef = defineComponent({ selectors: [['child']], type: ChildComponent, diff --git a/packages/core/test/render3/listeners_spec.ts b/packages/core/test/render3/listeners_spec.ts index f9aa7042ec..867a859d8e 100644 --- a/packages/core/test/render3/listeners_spec.ts +++ b/packages/core/test/render3/listeners_spec.ts @@ -46,7 +46,8 @@ describe('event listeners', () => { class PreventDefaultComp { handlerReturnValue: any = true; - event: Event; + // TODO(issue/24571): remove '!'. + event !: Event; onClick(e: any) { this.event = e; diff --git a/packages/core/test/render3/outputs_spec.ts b/packages/core/test/render3/outputs_spec.ts index f08cb0827b..c983fac6d8 100644 --- a/packages/core/test/render3/outputs_spec.ts +++ b/packages/core/test/render3/outputs_spec.ts @@ -358,7 +358,8 @@ describe('outputs', () => { let otherDir: OtherChangeDir; class OtherChangeDir { - change: boolean; + // TODO(issue/24571): remove '!'. + change !: boolean; static ngDirectiveDef = defineDirective({ type: OtherChangeDir, diff --git a/packages/core/test/render3/pipe_spec.ts b/packages/core/test/render3/pipe_spec.ts index e5da9bbcbe..3d7c0369d6 100644 --- a/packages/core/test/render3/pipe_spec.ts +++ b/packages/core/test/render3/pipe_spec.ts @@ -382,10 +382,13 @@ class MultiArgPipe implements PipeTransform { } class Person { - age: number; - name: string|null; + // TODO(issue/24571): remove '!'. + age !: number; + // TODO(issue/24571): remove '!'. + name !: string | null; address: Address|null = null; - phones: number[]; + // TODO(issue/24571): remove '!'. + phones !: number[]; init(name: string|null, address: Address|null = null) { this.name = name; diff --git a/packages/core/test/render3/properties_spec.ts b/packages/core/test/render3/properties_spec.ts index 5bfd9fcfcf..e586dd49d7 100644 --- a/packages/core/test/render3/properties_spec.ts +++ b/packages/core/test/render3/properties_spec.ts @@ -99,7 +99,8 @@ describe('elementProperty', () => { let idDir: IdDir; class MyButton { - disabled: boolean; + // TODO(issue/24571): remove '!'. + disabled !: boolean; static ngDirectiveDef = defineDirective({ type: MyButton, @@ -110,7 +111,8 @@ describe('elementProperty', () => { } class OtherDir { - id: boolean; + // TODO(issue/24571): remove '!'. + id !: boolean; clickStream = new EventEmitter(); static ngDirectiveDef = defineDirective({ @@ -123,7 +125,8 @@ describe('elementProperty', () => { } class OtherDisabledDir { - disabled: boolean; + // TODO(issue/24571): remove '!'. + disabled !: boolean; static ngDirectiveDef = defineDirective({ type: OtherDisabledDir, @@ -134,7 +137,8 @@ describe('elementProperty', () => { } class IdDir { - idNumber: number; + // TODO(issue/24571): remove '!'. + idNumber !: number; static ngDirectiveDef = defineDirective({ type: IdDir, @@ -208,7 +212,8 @@ describe('elementProperty', () => { let comp: Comp; class Comp { - id: number; + // TODO(issue/24571): remove '!'. + id !: number; static ngComponentDef = defineComponent({ type: Comp, @@ -358,8 +363,10 @@ describe('elementProperty', () => { describe('attributes and input properties', () => { let myDir: MyDir; class MyDir { - role: string; - direction: string; + // TODO(issue/24571): remove '!'. + role !: string; + // TODO(issue/24571): remove '!'. + direction !: string; changeStream = new EventEmitter(); static ngDirectiveDef = defineDirective({ @@ -374,7 +381,8 @@ describe('elementProperty', () => { let dirB: MyDirB; class MyDirB { - roleB: string; + // TODO(issue/24571): remove '!'. + roleB !: string; static ngDirectiveDef = defineDirective({ type: MyDirB, diff --git a/packages/core/test/render3/pure_function_spec.ts b/packages/core/test/render3/pure_function_spec.ts index c3290895f1..32d31f1f68 100644 --- a/packages/core/test/render3/pure_function_spec.ts +++ b/packages/core/test/render3/pure_function_spec.ts @@ -15,7 +15,8 @@ describe('array literals', () => { let myComp: MyComp; class MyComp { - names: string[]; + // TODO(issue/24571): remove '!'. + names !: string[]; static ngComponentDef = defineComponent({ type: MyComp, @@ -68,8 +69,10 @@ describe('array literals', () => { let manyPropComp: ManyPropComp; class ManyPropComp { - names1: string[]; - names2: string[]; + // TODO(issue/24571): remove '!'. + names1 !: string[]; + // TODO(issue/24571): remove '!'. + names2 !: string[]; static ngComponentDef = defineComponent({ type: ManyPropComp, @@ -331,7 +334,8 @@ describe('object literals', () => { let objectComp: ObjectComp; class ObjectComp { - config: {[key: string]: any}; + // TODO(issue/24571): remove '!'. + config !: {[key: string]: any}; static ngComponentDef = defineComponent({ type: ObjectComp, diff --git a/packages/core/test/render3/query_spec.ts b/packages/core/test/render3/query_spec.ts index 9c613e81d8..537f1b0b1d 100644 --- a/packages/core/test/render3/query_spec.ts +++ b/packages/core/test/render3/query_spec.ts @@ -933,7 +933,8 @@ describe('query', () => { * } */ class Cmpt { - value: string[]; + // TODO(issue/24571): remove '!'. + value !: string[]; query: any; static ngComponentDef = defineComponent({ type: Cmpt, @@ -1689,7 +1690,8 @@ describe('query', () => { class WithContentComponent { // @ContentChildren('foo') foos; - foos: QueryList; + // TODO(issue/24571): remove '!'. + foos !: QueryList; static ngComponentDef = defineComponent({ type: WithContentComponent, diff --git a/packages/core/test/render3/renderer_factory_spec.ts b/packages/core/test/render3/renderer_factory_spec.ts index 3cf26ecaf3..8edec6b303 100644 --- a/packages/core/test/render3/renderer_factory_spec.ts +++ b/packages/core/test/render3/renderer_factory_spec.ts @@ -136,7 +136,8 @@ describe('animation renderer factory', () => { } class SomeComponentWithAnimation { - exp: string; + // TODO(issue/24571): remove '!'. + exp !: string; callback(event: AnimationEvent) { eventLogs.push(`${event.fromState ? event.fromState : event.toState} - ${event.phaseName}`); } diff --git a/packages/core/test/render3/view_container_ref_spec.ts b/packages/core/test/render3/view_container_ref_spec.ts index d8282f76e7..cb4e31f50a 100644 --- a/packages/core/test/render3/view_container_ref_spec.ts +++ b/packages/core/test/render3/view_container_ref_spec.ts @@ -29,7 +29,8 @@ describe('ViewContainerRef', () => { inputs: {tplRef: 'tplRef'} }); - tplRef: TemplateRef<{}>; + // TODO(issue/24571): remove '!'. + tplRef !: TemplateRef<{}>; // injecting a ViewContainerRef to create a dynamic container in which embedded views will be // created @@ -215,7 +216,8 @@ describe('ViewContainerRef', () => { * |after */ class TestComponent { - testDir: TestDirective; + // TODO(issue/24571): remove '!'. + testDir !: TestDirective; static ngComponentDef = defineComponent({ type: TestComponent, selectors: [['test-cmp']], @@ -278,7 +280,8 @@ describe('ViewContainerRef', () => { */ class TestComponent { condition = false; - testDir: TestDirective; + // TODO(issue/24571): remove '!'. + testDir !: TestDirective; static ngComponentDef = defineComponent({ type: TestComponent, selectors: [['test-cmp']], @@ -335,7 +338,8 @@ describe('ViewContainerRef', () => { it('should apply directives and pipes of the host view to the TemplateRef', () => { @Component({selector: 'child', template: `{{name}}`}) class Child { - name: string; + // TODO(issue/24571): remove '!'. + name !: string; static ngComponentDef = defineComponent({ type: Child, @@ -902,7 +906,8 @@ describe('ViewContainerRef', () => { it('should call all hooks in correct order', () => { @Component({selector: 'hooks', template: `{{name}}`}) class ComponentWithHooks { - name: string; + // TODO(issue/24571): remove '!'. + name !: string; private log(msg: string) { log.push(msg); } diff --git a/packages/core/test/view/query_spec.ts b/packages/core/test/view/query_spec.ts index 4aded64ac0..1eba518ca9 100644 --- a/packages/core/test/view/query_spec.ts +++ b/packages/core/test/view/query_spec.ts @@ -20,7 +20,8 @@ import {compViewDef, compViewDefFactory, createAndGetRootNodes, createEmbeddedVi class AService {} class QueryService { - a: QueryList; + // TODO(issue/24571): remove '!'. + a !: QueryList; } function contentQueryProviders(checkIndex: number) { @@ -247,7 +248,8 @@ import {compViewDef, compViewDefFactory, createAndGetRootNodes, createEmbeddedVi describe('QueryBindingType', () => { it('should query all matches', () => { class QueryService { - a: QueryList; + // TODO(issue/24571): remove '!'. + a !: QueryList; } const {view} = createAndGetRootNodes(compViewDef([ @@ -272,7 +274,8 @@ import {compViewDef, compViewDefFactory, createAndGetRootNodes, createEmbeddedVi it('should query the first match', () => { class QueryService { - a: AService; + // TODO(issue/24571): remove '!'. + a !: AService; } const {view} = createAndGetRootNodes(compViewDef([ @@ -295,7 +298,8 @@ import {compViewDef, compViewDefFactory, createAndGetRootNodes, createEmbeddedVi describe('query builtins', () => { it('should query ElementRef', () => { class QueryService { - a: ElementRef; + // TODO(issue/24571): remove '!'. + a !: ElementRef; } const {view} = createAndGetRootNodes(compViewDef([ @@ -314,7 +318,8 @@ import {compViewDef, compViewDefFactory, createAndGetRootNodes, createEmbeddedVi it('should query TemplateRef', () => { class QueryService { - a: TemplateRef; + // TODO(issue/24571): remove '!'. + a !: TemplateRef; } const {view} = createAndGetRootNodes(compViewDef([ @@ -335,7 +340,8 @@ import {compViewDef, compViewDefFactory, createAndGetRootNodes, createEmbeddedVi it('should query ViewContainerRef', () => { class QueryService { - a: ViewContainerRef; + // TODO(issue/24571): remove '!'. + a !: ViewContainerRef; } const {view} = createAndGetRootNodes(compViewDef([ diff --git a/packages/core/testing/src/async_test_completer.ts b/packages/core/testing/src/async_test_completer.ts index 767017bfa8..cfa94d650e 100644 --- a/packages/core/testing/src/async_test_completer.ts +++ b/packages/core/testing/src/async_test_completer.ts @@ -10,8 +10,10 @@ * Injectable completer that allows signaling completion of an asynchronous test. Used internally. */ export class AsyncTestCompleter { - private _resolve: (result: any) => void; - private _reject: (err: any) => void; + // TODO(issue/24571): remove '!'. + private _resolve !: (result: any) => void; + // TODO(issue/24571): remove '!'. + private _reject !: (err: any) => void; private _promise: Promise = new Promise((res, rej) => { this._resolve = res; this._reject = rej; diff --git a/packages/elements/src/component-factory-strategy.ts b/packages/elements/src/component-factory-strategy.ts index 2474c0fc9e..a160d174be 100644 --- a/packages/elements/src/component-factory-strategy.ts +++ b/packages/elements/src/component-factory-strategy.ts @@ -44,10 +44,12 @@ export class ComponentNgElementStrategyFactory implements NgElementStrategyFacto */ export class ComponentNgElementStrategy implements NgElementStrategy { /** Merged stream of the component's output events. */ - events: Observable; + // TODO(issue/24571): remove '!'. + events !: Observable; /** Reference to the component that was created on connect. */ - private componentRef: ComponentRef|null; + // TODO(issue/24571): remove '!'. + private componentRef !: ComponentRef| null; /** Changes that have been made to the component ref since the last time onChanges was called. */ private inputChanges: SimpleChanges|null = null; diff --git a/packages/elements/src/create-custom-element.ts b/packages/elements/src/create-custom-element.ts index ce70f3ae7a..85078e9205 100644 --- a/packages/elements/src/create-custom-element.ts +++ b/packages/elements/src/create-custom-element.ts @@ -43,7 +43,8 @@ export abstract class NgElement extends HTMLElement { /** * The strategy that controls how a component is transformed in a custom element. */ - protected ngElementStrategy: NgElementStrategy; + // TODO(issue/24571): remove '!'. + protected ngElementStrategy !: NgElementStrategy; /** * A subscription to change, connect, and disconnect events in the custom element. */ diff --git a/packages/elements/test/create-custom-element_spec.ts b/packages/elements/test/create-custom-element_spec.ts index dbb82d31e4..94be8b4137 100644 --- a/packages/elements/test/create-custom-element_spec.ts +++ b/packages/elements/test/create-custom-element_spec.ts @@ -103,7 +103,8 @@ if (typeof customElements !== 'undefined') { }) class TestComponent { @Input() fooFoo: string = 'foo'; - @Input('barbar') barBar: string; + // TODO(issue/24571): remove '!'. + @Input('barbar') barBar !: string; @Output() bazBaz = new EventEmitter(); @Output('quxqux') quxQux = new EventEmitter(); diff --git a/packages/examples/common/pipes/ts/lowerupper_pipe.ts b/packages/examples/common/pipes/ts/lowerupper_pipe.ts index ad071916ed..4e466b0cbb 100644 --- a/packages/examples/common/pipes/ts/lowerupper_pipe.ts +++ b/packages/examples/common/pipes/ts/lowerupper_pipe.ts @@ -18,7 +18,8 @@ import {Component} from '@angular/core'; ` }) export class LowerUpperPipeComponent { - value: string; + // TODO(issue/24571): remove '!'. + value !: string; change(value: string) { this.value = value; } } // #enddocregion diff --git a/packages/examples/core/animation/ts/dsl/animation_example.ts b/packages/examples/core/animation/ts/dsl/animation_example.ts index f561085b58..dc3e527ed7 100644 --- a/packages/examples/core/animation/ts/dsl/animation_example.ts +++ b/packages/examples/core/animation/ts/dsl/animation_example.ts @@ -43,7 +43,8 @@ import {BrowserAnimationsModule} from '@angular/platform-browser/animations'; ` }) export class MyExpandoCmp { - stateExpression: string; + // TODO(issue/24571): remove '!'. + stateExpression !: string; constructor() { this.collapse(); } expand() { this.stateExpression = 'expanded'; } collapse() { this.stateExpression = 'collapsed'; } diff --git a/packages/examples/core/di/ts/contentChild/content_child_example.ts b/packages/examples/core/di/ts/contentChild/content_child_example.ts index cde1dfa40f..a734781912 100644 --- a/packages/examples/core/di/ts/contentChild/content_child_example.ts +++ b/packages/examples/core/di/ts/contentChild/content_child_example.ts @@ -11,7 +11,8 @@ import {Component, ContentChild, Directive, Input} from '@angular/core'; @Directive({selector: 'pane'}) export class Pane { - @Input() id: string; + // TODO(issue/24571): remove '!'. + @Input() id !: string; } @Component({ @@ -21,7 +22,8 @@ export class Pane { ` }) export class Tab { - @ContentChild(Pane) pane: Pane; + // TODO(issue/24571): remove '!'. + @ContentChild(Pane) pane !: Pane; } @Component({ diff --git a/packages/examples/core/di/ts/contentChild/content_child_howto.ts b/packages/examples/core/di/ts/contentChild/content_child_howto.ts index 830aca8d3b..1000fb3a62 100644 --- a/packages/examples/core/di/ts/contentChild/content_child_howto.ts +++ b/packages/examples/core/di/ts/contentChild/content_child_howto.ts @@ -15,7 +15,8 @@ class ChildDirective { @Directive({selector: 'someDir'}) class SomeDir implements AfterContentInit { - @ContentChild(ChildDirective) contentChild: ChildDirective; + // TODO(issue/24571): remove '!'. + @ContentChild(ChildDirective) contentChild !: ChildDirective; ngAfterContentInit() { // contentChild is set diff --git a/packages/examples/core/di/ts/contentChildren/content_children_example.ts b/packages/examples/core/di/ts/contentChildren/content_children_example.ts index 9e49b2077c..d298a93442 100644 --- a/packages/examples/core/di/ts/contentChildren/content_children_example.ts +++ b/packages/examples/core/di/ts/contentChildren/content_children_example.ts @@ -11,7 +11,8 @@ import {Component, ContentChildren, Directive, Input, QueryList} from '@angular/ @Directive({selector: 'pane'}) export class Pane { - @Input() id: string; + // TODO(issue/24571): remove '!'. + @Input() id !: string; } @Component({ @@ -22,8 +23,10 @@ export class Pane { ` }) export class Tab { - @ContentChildren(Pane) topLevelPanes: QueryList; - @ContentChildren(Pane, {descendants: true}) arbitraryNestedPanes: QueryList; + // TODO(issue/24571): remove '!'. + @ContentChildren(Pane) topLevelPanes !: QueryList; + // TODO(issue/24571): remove '!'. + @ContentChildren(Pane, {descendants: true}) arbitraryNestedPanes !: QueryList; get serializedPanes(): string { return this.topLevelPanes ? this.topLevelPanes.map(p => p.id).join(', ') : ''; diff --git a/packages/examples/core/di/ts/contentChildren/content_children_howto.ts b/packages/examples/core/di/ts/contentChildren/content_children_howto.ts index 268f5fefdf..776ed57daf 100644 --- a/packages/examples/core/di/ts/contentChildren/content_children_howto.ts +++ b/packages/examples/core/di/ts/contentChildren/content_children_howto.ts @@ -15,7 +15,8 @@ class ChildDirective { @Directive({selector: 'someDir'}) class SomeDir implements AfterContentInit { - @ContentChildren(ChildDirective) contentChildren: QueryList; + // TODO(issue/24571): remove '!'. + @ContentChildren(ChildDirective) contentChildren !: QueryList; ngAfterContentInit() { // contentChildren is set diff --git a/packages/examples/core/di/ts/provider_spec.ts b/packages/examples/core/di/ts/provider_spec.ts index 605ec44398..087a376759 100644 --- a/packages/examples/core/di/ts/provider_spec.ts +++ b/packages/examples/core/di/ts/provider_spec.ts @@ -55,7 +55,9 @@ import {Injectable, InjectionToken, Injector, Optional, ReflectiveInjector} from describe('ClassProvider', () => { it('works', () => { // #docregion ClassProvider - abstract class Shape { name: string; } + abstract class Shape { // TODO(issue/24571): remove '!'. + name !: string; + } class Square extends Shape { name = 'square'; @@ -92,7 +94,9 @@ import {Injectable, InjectionToken, Injector, Optional, ReflectiveInjector} from describe('StaticClassProvider', () => { it('works', () => { // #docregion StaticClassProvider - abstract class Shape { name: string; } + abstract class Shape { // TODO(issue/24571): remove '!'. + name !: string; + } class Square extends Shape { name = 'square'; diff --git a/packages/examples/core/di/ts/viewChild/view_child_example.ts b/packages/examples/core/di/ts/viewChild/view_child_example.ts index 8611d9037d..4f7ccd15b1 100644 --- a/packages/examples/core/di/ts/viewChild/view_child_example.ts +++ b/packages/examples/core/di/ts/viewChild/view_child_example.ts @@ -11,7 +11,8 @@ import {Component, Directive, Input, ViewChild} from '@angular/core'; @Directive({selector: 'pane'}) export class Pane { - @Input() id: string; + // TODO(issue/24571): remove '!'. + @Input() id !: string; } @Component({ diff --git a/packages/examples/core/di/ts/viewChild/view_child_howto.ts b/packages/examples/core/di/ts/viewChild/view_child_howto.ts index fb36209ad4..a0753ddbbb 100644 --- a/packages/examples/core/di/ts/viewChild/view_child_howto.ts +++ b/packages/examples/core/di/ts/viewChild/view_child_howto.ts @@ -15,7 +15,8 @@ class ChildDirective { @Component({selector: 'someCmp', templateUrl: 'someCmp.html'}) class SomeCmp implements AfterViewInit { - @ViewChild(ChildDirective) child: ChildDirective; + // TODO(issue/24571): remove '!'. + @ViewChild(ChildDirective) child !: ChildDirective; ngAfterViewInit() { // child is set diff --git a/packages/examples/core/di/ts/viewChildren/view_children_example.ts b/packages/examples/core/di/ts/viewChildren/view_children_example.ts index 361e4a598b..bd5e95233b 100644 --- a/packages/examples/core/di/ts/viewChildren/view_children_example.ts +++ b/packages/examples/core/di/ts/viewChildren/view_children_example.ts @@ -11,7 +11,8 @@ import {AfterViewInit, Component, Directive, Input, QueryList, ViewChildren} fro @Directive({selector: 'pane'}) export class Pane { - @Input() id: string; + // TODO(issue/24571): remove '!'. + @Input() id !: string; } @Component({ @@ -27,7 +28,8 @@ export class Pane { `, }) export class ViewChildrenComp implements AfterViewInit { - @ViewChildren(Pane) panes: QueryList; + // TODO(issue/24571): remove '!'. + @ViewChildren(Pane) panes !: QueryList; serializedPanes: string = ''; shouldShow = false; diff --git a/packages/examples/core/di/ts/viewChildren/view_children_howto.ts b/packages/examples/core/di/ts/viewChildren/view_children_howto.ts index 38f1f93d05..7675788391 100644 --- a/packages/examples/core/di/ts/viewChildren/view_children_howto.ts +++ b/packages/examples/core/di/ts/viewChildren/view_children_howto.ts @@ -15,7 +15,8 @@ class ChildDirective { @Component({selector: 'someCmp', templateUrl: 'someCmp.html'}) class SomeCmp implements AfterViewInit { - @ViewChildren(ChildDirective) viewChildren: QueryList; + // TODO(issue/24571): remove '!'. + @ViewChildren(ChildDirective) viewChildren !: QueryList; ngAfterViewInit() { // viewChildren is set diff --git a/packages/examples/core/ts/metadata/lifecycle_hooks_spec.ts b/packages/examples/core/ts/metadata/lifecycle_hooks_spec.ts index 197f64fa46..a4a0d76b59 100644 --- a/packages/examples/core/ts/metadata/lifecycle_hooks_spec.ts +++ b/packages/examples/core/ts/metadata/lifecycle_hooks_spec.ts @@ -106,8 +106,9 @@ import {TestBed} from '@angular/core/testing'; // #docregion OnChanges @Component({selector: 'my-cmp', template: `...`}) class MyComponent implements OnChanges { + // TODO(issue/24571): remove '!'. @Input() - prop: number; + prop !: number; ngOnChanges(changes: SimpleChanges) { // changes.prop contains the old and the new value... diff --git a/packages/examples/upgrade/static/ts/module.ts b/packages/examples/upgrade/static/ts/module.ts index 38abb49a04..832bfee563 100644 --- a/packages/examples/upgrade/static/ts/module.ts +++ b/packages/examples/upgrade/static/ts/module.ts @@ -30,7 +30,8 @@ interface Hero { `, }) class Ng2HeroesComponent { - @Input() heroes: Hero[]; + // TODO(issue/24571): remove '!'. + @Input() heroes !: Hero[]; @Output() addHero = new EventEmitter(); @Output() removeHero = new EventEmitter(); } @@ -69,8 +70,10 @@ class Ng1HeroComponentWrapper extends UpgradeComponent implements OnInit, OnChan OnDestroy { // The names of the input and output properties here must match the names of the // `<` and `&` bindings in the AngularJS component that is being wrapped - @Input() hero: Hero; - @Output() onRemove: EventEmitter; + // TODO(issue/24571): remove '!'. + @Input() hero !: Hero; + // TODO(issue/24571): remove '!'. + @Output() onRemove !: EventEmitter; constructor(@Inject(ElementRef) elementRef: ElementRef, @Inject(Injector) injector: Injector) { // We must pass the name of the directive as used by AngularJS to the super super('ng1Hero', elementRef, injector); diff --git a/packages/forms/src/directives/abstract_form_group_directive.ts b/packages/forms/src/directives/abstract_form_group_directive.ts index 91e446a33c..ff1cf32125 100644 --- a/packages/forms/src/directives/abstract_form_group_directive.ts +++ b/packages/forms/src/directives/abstract_form_group_directive.ts @@ -24,13 +24,16 @@ import {AsyncValidatorFn, ValidatorFn} from './validators'; */ export class AbstractFormGroupDirective extends ControlContainer implements OnInit, OnDestroy { /** @internal */ - _parent: ControlContainer; + // TODO(issue/24571): remove '!'. + _parent !: ControlContainer; /** @internal */ - _validators: any[]; + // TODO(issue/24571): remove '!'. + _validators !: any[]; /** @internal */ - _asyncValidators: any[]; + // TODO(issue/24571): remove '!'. + _asyncValidators !: any[]; ngOnInit(): void { this._checkParentType(); diff --git a/packages/forms/src/directives/control_container.ts b/packages/forms/src/directives/control_container.ts index 9002b212ab..1f5cd0293f 100644 --- a/packages/forms/src/directives/control_container.ts +++ b/packages/forms/src/directives/control_container.ts @@ -18,7 +18,8 @@ import {Form} from './form_interface'; * */ export abstract class ControlContainer extends AbstractControlDirective { - name: string; + // TODO(issue/24571): remove '!'. + name !: string; /** * Get the form to which this container belongs. diff --git a/packages/forms/src/directives/ng_form.ts b/packages/forms/src/directives/ng_form.ts index ee285127bf..1ba42526b6 100644 --- a/packages/forms/src/directives/ng_form.ts +++ b/packages/forms/src/directives/ng_form.ts @@ -93,7 +93,8 @@ export class NgForm extends ControlContainer implements Form, * ``` * */ - @Input('ngFormOptions') options: {updateOn?: FormHooks}; + // TODO(issue/24571): remove '!'. + @Input('ngFormOptions') options !: {updateOn?: FormHooks}; constructor( @Optional() @Self() @Inject(NG_VALIDATORS) validators: any[], diff --git a/packages/forms/src/directives/ng_model.ts b/packages/forms/src/directives/ng_model.ts index 882153d794..966bbe04b2 100644 --- a/packages/forms/src/directives/ng_model.ts +++ b/packages/forms/src/directives/ng_model.ts @@ -115,8 +115,10 @@ export class NgModel extends NgControl implements OnChanges, _registered = false; viewModel: any; - @Input() name: string; - @Input('disabled') isDisabled: boolean; + // TODO(issue/24571): remove '!'. + @Input() name !: string; + // TODO(issue/24571): remove '!'. + @Input('disabled') isDisabled !: boolean; @Input('ngModel') model: any; /** @@ -156,7 +158,9 @@ export class NgModel extends NgControl implements OnChanges, * ``` * */ - @Input('ngModelOptions') options: {name?: string, standalone?: boolean, updateOn?: FormHooks}; + // TODO(issue/24571): remove '!'. + @Input('ngModelOptions') + options !: {name?: string, standalone?: boolean, updateOn?: FormHooks}; @Output('ngModelChange') update = new EventEmitter(); diff --git a/packages/forms/src/directives/ng_model_group.ts b/packages/forms/src/directives/ng_model_group.ts index 88af18344b..e6d88209c8 100644 --- a/packages/forms/src/directives/ng_model_group.ts +++ b/packages/forms/src/directives/ng_model_group.ts @@ -47,7 +47,8 @@ export const modelGroupProvider: any = { */ @Directive({selector: '[ngModelGroup]', providers: [modelGroupProvider], exportAs: 'ngModelGroup'}) export class NgModelGroup extends AbstractFormGroupDirective implements OnInit, OnDestroy { - @Input('ngModelGroup') name: string; + // TODO(issue/24571): remove '!'. + @Input('ngModelGroup') name !: string; constructor( @Host() @SkipSelf() parent: ControlContainer, diff --git a/packages/forms/src/directives/radio_control_value_accessor.ts b/packages/forms/src/directives/radio_control_value_accessor.ts index 13343f7bd3..9816da683f 100644 --- a/packages/forms/src/directives/radio_control_value_accessor.ts +++ b/packages/forms/src/directives/radio_control_value_accessor.ts @@ -92,16 +92,21 @@ export class RadioControlRegistry { export class RadioControlValueAccessor implements ControlValueAccessor, OnDestroy, OnInit { /** @internal */ - _state: boolean; + // TODO(issue/24571): remove '!'. + _state !: boolean; /** @internal */ - _control: NgControl; + // TODO(issue/24571): remove '!'. + _control !: NgControl; /** @internal */ - _fn: Function; + // TODO(issue/24571): remove '!'. + _fn !: Function; onChange = () => {}; onTouched = () => {}; - @Input() name: string; - @Input() formControlName: string; + // TODO(issue/24571): remove '!'. + @Input() name !: string; + // TODO(issue/24571): remove '!'. + @Input() formControlName !: string; @Input() value: any; constructor( diff --git a/packages/forms/src/directives/reactive_directives/form_control_directive.ts b/packages/forms/src/directives/reactive_directives/form_control_directive.ts index 0683aeba66..51b9068aae 100644 --- a/packages/forms/src/directives/reactive_directives/form_control_directive.ts +++ b/packages/forms/src/directives/reactive_directives/form_control_directive.ts @@ -141,7 +141,8 @@ export const formControlBinding: any = { export class FormControlDirective extends NgControl implements OnChanges { viewModel: any; - @Input('formControl') form: FormControl; + // TODO(issue/24571): remove '!'. + @Input('formControl') form !: FormControl; @Input('disabled') set isDisabled(isDisabled: boolean) { ReactiveErrors.disabledAttrWarning(); } diff --git a/packages/forms/src/directives/reactive_directives/form_control_name.ts b/packages/forms/src/directives/reactive_directives/form_control_name.ts index da9bb6de83..66cfa050e7 100644 --- a/packages/forms/src/directives/reactive_directives/form_control_name.ts +++ b/packages/forms/src/directives/reactive_directives/form_control_name.ts @@ -153,9 +153,11 @@ export class FormControlName extends NgControl implements OnChanges, OnDestroy { private _added = false; /** @internal */ viewModel: any; - readonly control: FormControl; + // TODO(issue/24571): remove '!'. + readonly control !: FormControl; - @Input('formControlName') name: string; + // TODO(issue/24571): remove '!'. + @Input('formControlName') name !: string; @Input('disabled') set isDisabled(isDisabled: boolean) { ReactiveErrors.disabledAttrWarning(); } diff --git a/packages/forms/src/directives/reactive_directives/form_group_directive.ts b/packages/forms/src/directives/reactive_directives/form_group_directive.ts index cd5562e83c..05b244ac59 100644 --- a/packages/forms/src/directives/reactive_directives/form_group_directive.ts +++ b/packages/forms/src/directives/reactive_directives/form_group_directive.ts @@ -68,7 +68,8 @@ export class FormGroupDirective extends ControlContainer implements Form, OnChanges { public readonly submitted: boolean = false; - private _oldForm: FormGroup; + // TODO(issue/24571): remove '!'. + private _oldForm !: FormGroup; directives: FormControlName[] = []; @Input('formGroup') form: FormGroup = null !; diff --git a/packages/forms/src/directives/reactive_directives/form_group_name.ts b/packages/forms/src/directives/reactive_directives/form_group_name.ts index eb125784f0..b53d1464ab 100644 --- a/packages/forms/src/directives/reactive_directives/form_group_name.ts +++ b/packages/forms/src/directives/reactive_directives/form_group_name.ts @@ -69,7 +69,8 @@ export const formGroupNameProvider: any = { */ @Directive({selector: '[formGroupName]', providers: [formGroupNameProvider]}) export class FormGroupName extends AbstractFormGroupDirective implements OnInit, OnDestroy { - @Input('formGroupName') name: string; + // TODO(issue/24571): remove '!'. + @Input('formGroupName') name !: string; constructor( @Optional() @Host() @SkipSelf() parent: ControlContainer, @@ -152,7 +153,8 @@ export class FormArrayName extends ControlContainer implements OnInit, OnDestroy /** @internal */ _asyncValidators: any[]; - @Input('formArrayName') name: string; + // TODO(issue/24571): remove '!'. + @Input('formArrayName') name !: string; constructor( @Optional() @Host() @SkipSelf() parent: ControlContainer, diff --git a/packages/forms/src/directives/select_control_value_accessor.ts b/packages/forms/src/directives/select_control_value_accessor.ts index bd3d8bafaf..1597ae8872 100644 --- a/packages/forms/src/directives/select_control_value_accessor.ts +++ b/packages/forms/src/directives/select_control_value_accessor.ts @@ -168,7 +168,8 @@ export class SelectControlValueAccessor implements ControlValueAccessor { */ @Directive({selector: 'option'}) export class NgSelectOption implements OnDestroy { - id: string; + // TODO(issue/24571): remove '!'. + id !: string; constructor( private _element: ElementRef, private _renderer: Renderer2, diff --git a/packages/forms/src/directives/select_multiple_control_value_accessor.ts b/packages/forms/src/directives/select_multiple_control_value_accessor.ts index 4dae1c507a..d30433b1aa 100644 --- a/packages/forms/src/directives/select_multiple_control_value_accessor.ts +++ b/packages/forms/src/directives/select_multiple_control_value_accessor.ts @@ -35,7 +35,8 @@ interface HTMLOption { /** Mock interface for HTMLCollection */ abstract class HTMLCollection { - length: number; + // TODO(issue/24571): remove '!'. + length !: number; abstract item(_: number): HTMLOption; } @@ -177,7 +178,8 @@ export class SelectMultipleControlValueAccessor implements ControlValueAccessor */ @Directive({selector: 'option'}) export class NgSelectMultipleOption implements OnDestroy { - id: string; + // TODO(issue/24571): remove '!'. + id !: string; /** @internal */ _value: any; diff --git a/packages/forms/src/directives/validators.ts b/packages/forms/src/directives/validators.ts index 791392770d..74bd818b55 100644 --- a/packages/forms/src/directives/validators.ts +++ b/packages/forms/src/directives/validators.ts @@ -79,8 +79,10 @@ export const CHECKBOX_REQUIRED_VALIDATOR: StaticProvider = { host: {'[attr.required]': 'required ? "" : null'} }) export class RequiredValidator implements Validator { - private _required: boolean; - private _onChange: () => void; + // TODO(issue/24571): remove '!'. + private _required !: boolean; + // TODO(issue/24571): remove '!'. + private _onChange !: () => void; @Input() get required(): boolean|string { return this._required; } @@ -150,8 +152,10 @@ export const EMAIL_VALIDATOR: any = { providers: [EMAIL_VALIDATOR] }) export class EmailValidator implements Validator { - private _enabled: boolean; - private _onChange: () => void; + // TODO(issue/24571): remove '!'. + private _enabled !: boolean; + // TODO(issue/24571): remove '!'. + private _onChange !: () => void; @Input() set email(value: boolean|string) { @@ -198,10 +202,13 @@ export const MIN_LENGTH_VALIDATOR: any = { }) export class MinLengthValidator implements Validator, OnChanges { - private _validator: ValidatorFn; - private _onChange: () => void; + // TODO(issue/24571): remove '!'. + private _validator !: ValidatorFn; + // TODO(issue/24571): remove '!'. + private _onChange !: () => void; - @Input() minlength: string; + // TODO(issue/24571): remove '!'. + @Input() minlength !: string; ngOnChanges(changes: SimpleChanges): void { if ('minlength' in changes) { @@ -248,10 +255,13 @@ export const MAX_LENGTH_VALIDATOR: any = { }) export class MaxLengthValidator implements Validator, OnChanges { - private _validator: ValidatorFn; - private _onChange: () => void; + // TODO(issue/24571): remove '!'. + private _validator !: ValidatorFn; + // TODO(issue/24571): remove '!'. + private _onChange !: () => void; - @Input() maxlength: string; + // TODO(issue/24571): remove '!'. + @Input() maxlength !: string; ngOnChanges(changes: SimpleChanges): void { if ('maxlength' in changes) { @@ -299,10 +309,13 @@ export const PATTERN_VALIDATOR: any = { }) export class PatternValidator implements Validator, OnChanges { - private _validator: ValidatorFn; - private _onChange: () => void; + // TODO(issue/24571): remove '!'. + private _validator !: ValidatorFn; + // TODO(issue/24571): remove '!'. + private _onChange !: () => void; - @Input() pattern: string|RegExp; + // TODO(issue/24571): remove '!'. + @Input() pattern !: string | RegExp; ngOnChanges(changes: SimpleChanges): void { if ('pattern' in changes) { diff --git a/packages/forms/src/model.ts b/packages/forms/src/model.ts index c0edddc4c9..af833c8e39 100644 --- a/packages/forms/src/model.ts +++ b/packages/forms/src/model.ts @@ -133,18 +133,22 @@ function isOptionsObj( */ export abstract class AbstractControl { /** @internal */ - _pendingDirty: boolean; + // TODO(issue/24571): remove '!'. + _pendingDirty !: boolean; /** @internal */ - _pendingTouched: boolean; + // TODO(issue/24571): remove '!'. + _pendingTouched !: boolean; /** @internal */ _onCollectionChange = () => {}; /** @internal */ - _updateOn: FormHooks; + // TODO(issue/24571): remove '!'. + _updateOn !: FormHooks; - private _parent: FormGroup|FormArray; + // TODO(issue/24571): remove '!'. + private _parent !: FormGroup | FormArray; private _asyncValidationSubscription: any; /** @@ -184,7 +188,8 @@ export abstract class AbstractControl { * These status values are mutually exclusive, so a control cannot be * both valid AND invalid or invalid AND disabled. */ - public readonly status: string; + // TODO(issue/24571): remove '!'. + public readonly status !: string; /** * A control is `valid` when its `status` is `VALID`. @@ -244,7 +249,8 @@ export abstract class AbstractControl { * An object containing any errors generated by failing validation, * or null if there are no errors. */ - public readonly errors: ValidationErrors|null; + // TODO(issue/24571): remove '!'. + public readonly errors !: ValidationErrors | null; /** * A control is `pristine` if the user has not yet changed @@ -284,13 +290,15 @@ export abstract class AbstractControl { * A multicasting observable that emits an event every time the value of the control changes, in * the UI or programmatically. */ - public readonly valueChanges: Observable; + // TODO(issue/24571): remove '!'. + public readonly valueChanges !: Observable; /** * A multicasting observable that emits an event every time the validation `status` of the control * recalculates. */ - public readonly statusChanges: Observable; + // TODO(issue/24571): remove '!'. + public readonly statusChanges !: Observable; /** * Reports the update strategy of the `AbstractControl` (meaning diff --git a/packages/forms/test/reactive_integration_spec.ts b/packages/forms/test/reactive_integration_spec.ts index b1335d272c..2068970d86 100644 --- a/packages/forms/test/reactive_integration_spec.ts +++ b/packages/forms/test/reactive_integration_spec.ts @@ -2467,7 +2467,8 @@ function sortedClassList(el: HTMLElement) { @Component({selector: 'form-control-comp', template: ``}) class FormControlComp { - control: FormControl; + // TODO(issue/24571): remove '!'. + control !: FormControl; } @Component({ @@ -2478,9 +2479,12 @@ class FormControlComp { ` }) class FormGroupComp { - control: FormControl; - form: FormGroup; - event: Event; + // TODO(issue/24571): remove '!'. + control !: FormControl; + // TODO(issue/24571): remove '!'. + form !: FormGroup; + // TODO(issue/24571): remove '!'. + event !: Event; } @Component({ @@ -2495,7 +2499,8 @@ class FormGroupComp { ` }) class NestedFormGroupComp { - form: FormGroup; + // TODO(issue/24571): remove '!'. + form !: FormGroup; } @Component({ @@ -2510,8 +2515,10 @@ class NestedFormGroupComp { ` }) class FormArrayComp { - form: FormGroup; - cityArray: FormArray; + // TODO(issue/24571): remove '!'. + form !: FormGroup; + // TODO(issue/24571): remove '!'. + cityArray !: FormArray; } @Component({ @@ -2527,8 +2534,10 @@ class FormArrayComp { ` }) class FormArrayNestedGroup { - form: FormGroup; - cityArray: FormArray; + // TODO(issue/24571): remove '!'. + form !: FormGroup; + // TODO(issue/24571): remove '!'. + cityArray !: FormArray; } @Component({ @@ -2540,9 +2549,12 @@ class FormArrayNestedGroup { ` }) class FormGroupNgModel { - form: FormGroup; - login: string; - password: string; + // TODO(issue/24571): remove '!'. + form !: FormGroup; + // TODO(issue/24571): remove '!'. + login !: string; + // TODO(issue/24571): remove '!'. + password !: string; } @Component({ @@ -2553,10 +2565,14 @@ class FormGroupNgModel { ` }) class FormControlNgModel { - control: FormControl; - login: string; - passwordControl: FormControl; - password: string; + // TODO(issue/24571): remove '!'. + control !: FormControl; + // TODO(issue/24571): remove '!'. + login !: string; + // TODO(issue/24571): remove '!'. + passwordControl !: FormControl; + // TODO(issue/24571): remove '!'. + password !: string; } @Component({ @@ -2570,7 +2586,8 @@ class FormControlNgModel { ` }) class LoginIsEmptyWrapper { - form: FormGroup; + // TODO(issue/24571): remove '!'. + form !: FormGroup; } @Component({ @@ -2584,11 +2601,16 @@ class LoginIsEmptyWrapper { ` }) class ValidationBindingsForm { - form: FormGroup; - required: boolean; - minLen: number; - maxLen: number; - pattern: string; + // TODO(issue/24571): remove '!'. + form !: FormGroup; + // TODO(issue/24571): remove '!'. + required !: boolean; + // TODO(issue/24571): remove '!'. + minLen !: number; + // TODO(issue/24571): remove '!'. + maxLen !: number; + // TODO(issue/24571): remove '!'. + pattern !: string; } @Component({ @@ -2596,7 +2618,8 @@ class ValidationBindingsForm { template: `` }) class FormControlCheckboxRequiredValidator { - control: FormControl; + // TODO(issue/24571): remove '!'. + control !: FormControl; } @Component({ @@ -2607,5 +2630,6 @@ class FormControlCheckboxRequiredValidator { ` }) class UniqLoginWrapper { - form: FormGroup; + // TODO(issue/24571): remove '!'. + form !: FormGroup; } diff --git a/packages/forms/test/template_integration_spec.ts b/packages/forms/test/template_integration_spec.ts index fa8bca586b..8782a89966 100644 --- a/packages/forms/test/template_integration_spec.ts +++ b/packages/forms/test/template_integration_spec.ts @@ -1640,7 +1640,8 @@ import {NgModelCustomComp, NgModelCustomWrapper} from './value_accessor_integrat ` }) class StandaloneNgModel { - name: string; + // TODO(issue/24571): remove '!'. + name !: string; } @Component({ @@ -1652,8 +1653,10 @@ class StandaloneNgModel { ` }) class NgModelForm { - name: string; - event: Event; + // TODO(issue/24571): remove '!'. + name !: string; + // TODO(issue/24571): remove '!'. + event !: Event; options = {}; onReset() {} @@ -1676,10 +1679,14 @@ class NgModelNativeValidateForm { ` }) class NgModelGroupForm { - first: string; - last: string; - email: string; - isDisabled: boolean; + // TODO(issue/24571): remove '!'. + first !: string; + // TODO(issue/24571): remove '!'. + last !: string; + // TODO(issue/24571): remove '!'. + email !: string; + // TODO(issue/24571): remove '!'. + isDisabled !: boolean; options = {updateOn: 'change'}; } @@ -1695,7 +1702,8 @@ class NgModelGroupForm { ` }) class NgModelValidBinding { - first: string; + // TODO(issue/24571): remove '!'. + first !: string; } @@ -1711,10 +1719,12 @@ class NgModelValidBinding { ` }) class NgModelNgIfForm { - first: string; + // TODO(issue/24571): remove '!'. + first !: string; groupShowing = true; emailShowing = true; - email: string; + // TODO(issue/24571): remove '!'. + email !: string; } @Component({ @@ -1749,8 +1759,10 @@ class InvalidNgModelNoName { ` }) class NgModelOptionsStandalone { - one: string; - two: string; + // TODO(issue/24571): remove '!'. + one !: string; + // TODO(issue/24571): remove '!'. + two !: string; options: {name?: string, standalone?: boolean, updateOn?: string} = {standalone: true}; formOptions = {}; } @@ -1767,10 +1779,14 @@ class NgModelOptionsStandalone { ` }) class NgModelValidationBindings { - required: boolean; - minLen: number; - maxLen: number; - pattern: string; + // TODO(issue/24571): remove '!'. + required !: boolean; + // TODO(issue/24571): remove '!'. + minLen !: number; + // TODO(issue/24571): remove '!'. + maxLen !: number; + // TODO(issue/24571): remove '!'. + pattern !: string; } @Component({ @@ -1782,9 +1798,12 @@ class NgModelValidationBindings { ` }) class NgModelMultipleValidators { - required: boolean; - minLen: number; - pattern: string|RegExp; + // TODO(issue/24571): remove '!'. + required !: boolean; + // TODO(issue/24571): remove '!'. + minLen !: number; + // TODO(issue/24571): remove '!'. + pattern !: string | RegExp; } @Component({ @@ -1832,7 +1851,8 @@ class NgModelAsyncValidation { ` }) class NgModelChangesForm { - name: string; + // TODO(issue/24571): remove '!'. + name !: string; events: string[] = []; options: any; diff --git a/packages/forms/test/value_accessor_integration_spec.ts b/packages/forms/test/value_accessor_integration_spec.ts index dec9d7e418..609592b09e 100644 --- a/packages/forms/test/value_accessor_integration_spec.ts +++ b/packages/forms/test/value_accessor_integration_spec.ts @@ -1088,7 +1088,8 @@ import {dispatchEvent} from '@angular/platform-browser/testing/src/browser_util' @Component({selector: 'form-control-comp', template: ``}) export class FormControlComp { - control: FormControl; + // TODO(issue/24571): remove '!'. + control !: FormControl; } @Component({ @@ -1099,10 +1100,14 @@ export class FormControlComp { ` }) export class FormGroupComp { - control: FormControl; - form: FormGroup; - myGroup: FormGroup; - event: Event; + // TODO(issue/24571): remove '!'. + control !: FormControl; + // TODO(issue/24571): remove '!'. + form !: FormGroup; + // TODO(issue/24571): remove '!'. + myGroup !: FormGroup; + // TODO(issue/24571): remove '!'. + event !: Event; } @Component({ @@ -1110,7 +1115,8 @@ export class FormGroupComp { template: `` }) class FormControlNumberInput { - control: FormControl; + // TODO(issue/24571): remove '!'. + control !: FormControl; } @Component({ @@ -1269,7 +1275,8 @@ class NgModelSelectMultipleWithCustomCompareFnForm { ` }) class NgModelSelectMultipleForm { - selectedCities: any[]; + // TODO(issue/24571): remove '!'. + selectedCities !: any[]; cities: any[] = []; } @@ -1278,7 +1285,8 @@ class NgModelSelectMultipleForm { template: `` }) class FormControlRangeInput { - control: FormControl; + // TODO(issue/24571): remove '!'. + control !: FormControl; } @Component({selector: 'ng-model-range-form', template: ''}) @@ -1299,7 +1307,8 @@ class NgModelRangeForm { ` }) export class FormControlRadioButtons { - form: FormGroup; + // TODO(issue/24571): remove '!'. + form !: FormGroup; showRadio = new FormControl('yes'); } @@ -1316,8 +1325,10 @@ export class FormControlRadioButtons { ` }) class NgModelRadioForm { - food: string; - drink: string; + // TODO(issue/24571): remove '!'. + food !: string; + // TODO(issue/24571): remove '!'. + drink !: string; } @Directive({ @@ -1330,7 +1341,8 @@ class NgModelRadioForm { }) class WrappedValue implements ControlValueAccessor { value: any; - onChange: Function; + // TODO(issue/24571): remove '!'. + onChange !: Function; writeValue(value: any) { this.value = `!${value}!`; } @@ -1345,7 +1357,8 @@ class WrappedValue implements ControlValueAccessor { @Component({selector: 'my-input', template: ''}) export class MyInput implements ControlValueAccessor { @Output('input') onInput = new EventEmitter(); - value: string; + // TODO(issue/24571): remove '!'. + value !: string; constructor(cd: NgControl) { cd.valueAccessor = this; } @@ -1366,7 +1379,8 @@ export class MyInput implements ControlValueAccessor { ` }) export class MyInputForm { - form: FormGroup; + // TODO(issue/24571): remove '!'. + form !: FormGroup; } @Component({ @@ -1377,7 +1391,8 @@ export class MyInputForm { ` }) class WrappedValueForm { - form: FormGroup; + // TODO(issue/24571): remove '!'. + form !: FormGroup; } @Component({ @@ -1388,9 +1403,11 @@ class WrappedValueForm { providers: [{provide: NG_VALUE_ACCESSOR, multi: true, useExisting: NgModelCustomComp}] }) export class NgModelCustomComp implements ControlValueAccessor { - model: string; + // TODO(issue/24571): remove '!'. + model !: string; @Input('disabled') isDisabled: boolean = false; - changeFn: (value: any) => void; + // TODO(issue/24571): remove '!'. + changeFn !: (value: any) => void; writeValue(value: any) { this.model = value; } @@ -1410,6 +1427,7 @@ export class NgModelCustomComp implements ControlValueAccessor { ` }) export class NgModelCustomWrapper { - name: string; + // TODO(issue/24571): remove '!'. + name !: string; isDisabled = false; } diff --git a/packages/http/src/backends/jsonp_backend.ts b/packages/http/src/backends/jsonp_backend.ts index a3fc353b8c..85a015cb3d 100644 --- a/packages/http/src/backends/jsonp_backend.ts +++ b/packages/http/src/backends/jsonp_backend.ts @@ -26,15 +26,18 @@ const JSONP_ERR_WRONG_METHOD = 'JSONP requests must use GET request method.'; * @deprecated see https://angular.io/guide/http */ export class JSONPConnection implements Connection { - private _id: string; - private _script: Element; + // TODO(issue/24571): remove '!'. + private _id !: string; + // TODO(issue/24571): remove '!'. + private _script !: Element; private _responseData: any; private _finished: boolean = false; /** * The {@link ReadyState} of this request. */ - readyState: ReadyState; + // TODO(issue/24571): remove '!'. + readyState !: ReadyState; /** * The outgoing HTTP request. diff --git a/packages/http/src/backends/xhr_backend.ts b/packages/http/src/backends/xhr_backend.ts index 2238829b8a..44cda08ad9 100644 --- a/packages/http/src/backends/xhr_backend.ts +++ b/packages/http/src/backends/xhr_backend.ts @@ -37,7 +37,8 @@ export class XHRConnection implements Connection { * `XMLHttpRequest`. */ response: Observable; - readyState: ReadyState; + // TODO(issue/24571): remove '!'. + readyState !: ReadyState; constructor(req: Request, browserXHR: BrowserXhr, baseResponseOptions?: ResponseOptions) { this.request = req; this.response = new Observable((responseObserver: Observer) => { diff --git a/packages/http/src/interfaces.ts b/packages/http/src/interfaces.ts index 4c84b44d44..e8252f32da 100644 --- a/packages/http/src/interfaces.ts +++ b/packages/http/src/interfaces.ts @@ -27,8 +27,10 @@ export abstract class ConnectionBackend { abstract createConnection(request: any * @deprecated see https://angular.io/guide/http */ export abstract class Connection { - readyState: ReadyState; - request: Request; + // TODO(issue/24571): remove '!'. + readyState !: ReadyState; + // TODO(issue/24571): remove '!'. + request !: Request; response: any; // TODO: generic of ; } diff --git a/packages/http/src/static_response.ts b/packages/http/src/static_response.ts index 0cdaec8bc7..668cf146fb 100644 --- a/packages/http/src/static_response.ts +++ b/packages/http/src/static_response.ts @@ -70,13 +70,15 @@ export class Response extends Body { * Denotes how many of the response body's bytes have been loaded, for example if the response is * the result of a progress event. */ - bytesLoaded: number; + // TODO(issue/24571): remove '!'. + bytesLoaded !: number; /** * Non-standard property * * Denotes how many bytes are expected in the final response body. */ - totalBytes: number; + // TODO(issue/24571): remove '!'. + totalBytes !: number; /** * Headers object based on the `Headers` class in the [Fetch * Spec](https://fetch.spec.whatwg.org/#headers-class). diff --git a/packages/http/test/backends/jsonp_backend_spec.ts b/packages/http/test/backends/jsonp_backend_spec.ts index f9fc4f4f35..9f2cacf37e 100644 --- a/packages/http/test/backends/jsonp_backend_spec.ts +++ b/packages/http/test/backends/jsonp_backend_spec.ts @@ -20,7 +20,8 @@ import {expect} from '@angular/platform-browser/testing/src/matchers'; let existingScripts: MockBrowserJsonp[] = []; class MockBrowserJsonp extends BrowserJsonp { - src: string; + // TODO(issue/24571): remove '!'. + src !: string; callbacks = new Map any>(); addEventListener(type: string, cb: (data: any) => any) { this.callbacks.set(type, cb); } diff --git a/packages/http/test/backends/xhr_backend_spec.ts b/packages/http/test/backends/xhr_backend_spec.ts index c9d966177b..8c2228c711 100644 --- a/packages/http/test/backends/xhr_backend_spec.ts +++ b/packages/http/test/backends/xhr_backend_spec.ts @@ -32,14 +32,20 @@ class MockBrowserXHR extends BrowserXhr { open: any; response: any; responseType: string; - responseText: string; + // TODO(issue/24571): remove '!'. + responseText !: string; setRequestHeader: any; callbacks = new Map(); - status: number; - responseHeaders: string; - responseURL: string; - statusText: string; - withCredentials: boolean; + // TODO(issue/24571): remove '!'. + status !: number; + // TODO(issue/24571): remove '!'. + responseHeaders !: string; + // TODO(issue/24571): remove '!'. + responseURL !: string; + // TODO(issue/24571): remove '!'. + statusText !: string; + // TODO(issue/24571): remove '!'. + withCredentials !: boolean; constructor() { super(); diff --git a/packages/language-service/src/reflector_host.ts b/packages/language-service/src/reflector_host.ts index d3443aa4df..42df27c8cc 100644 --- a/packages/language-service/src/reflector_host.ts +++ b/packages/language-service/src/reflector_host.ts @@ -33,7 +33,8 @@ class ReflectorModuleModuleResolutionHost implements ts.ModuleResolutionHost, Me return undefined !; } - directoryExists: (directoryName: string) => boolean; + // TODO(issue/24571): remove '!'. + directoryExists !: (directoryName: string) => boolean; getSourceFileMetadata(fileName: string) { const sf = this.getProgram().getSourceFile(fileName); diff --git a/packages/language-service/src/typescript_host.ts b/packages/language-service/src/typescript_host.ts index ab311f9a9d..de1e9f4afe 100644 --- a/packages/language-service/src/typescript_host.ts +++ b/packages/language-service/src/typescript_host.ts @@ -61,22 +61,33 @@ export class DummyResourceLoader extends ResourceLoader { * @experimental */ export class TypeScriptServiceHost implements LanguageServiceHost { - private _resolver: CompileMetadataResolver|null; + // TODO(issue/24571): remove '!'. + private _resolver !: CompileMetadataResolver | null; private _staticSymbolCache = new StaticSymbolCache(); - private _summaryResolver: AotSummaryResolver; - private _staticSymbolResolver: StaticSymbolResolver; - private _reflector: StaticReflector|null; - private _reflectorHost: ReflectorHost; - private _checker: ts.TypeChecker|null; + // TODO(issue/24571): remove '!'. + private _summaryResolver !: AotSummaryResolver; + // TODO(issue/24571): remove '!'. + private _staticSymbolResolver !: StaticSymbolResolver; + // TODO(issue/24571): remove '!'. + private _reflector !: StaticReflector | null; + // TODO(issue/24571): remove '!'. + private _reflectorHost !: ReflectorHost; + // TODO(issue/24571): remove '!'. + private _checker !: ts.TypeChecker | null; private _typeCache: Symbol[] = []; private context: string|undefined; private lastProgram: ts.Program|undefined; private modulesOutOfDate: boolean = true; - private analyzedModules: NgAnalyzedModules|null; - private service: LanguageService; - private fileToComponent: Map|null; - private templateReferences: string[]|null; - private collectedErrors: Map|null; + // TODO(issue/24571): remove '!'. + private analyzedModules !: NgAnalyzedModules | null; + // TODO(issue/24571): remove '!'. + private service !: LanguageService; + // TODO(issue/24571): remove '!'. + private fileToComponent !: Map| null; + // TODO(issue/24571): remove '!'. + private templateReferences !: string[] | null; + // TODO(issue/24571): remove '!'. + private collectedErrors !: Map| null; private fileVersions = new Map(); constructor(private host: ts.LanguageServiceHost, private tsService: ts.LanguageService) {} diff --git a/packages/language-service/test/test_utils.ts b/packages/language-service/test/test_utils.ts index a3357668f1..9032df6248 100644 --- a/packages/language-service/test/test_utils.ts +++ b/packages/language-service/test/test_utils.ts @@ -65,7 +65,8 @@ missingCache.set('/node_modules/@angular/forms/src/directives/form_interface.met export class MockTypescriptHost implements ts.LanguageServiceHost { private angularPath: string|undefined; - private nodeModulesPath: string; + // TODO(issue/24571): remove '!'. + private nodeModulesPath !: string; private scriptVersion = new Map(); private overrides = new Map(); private projectVersion = 0; diff --git a/packages/platform-browser/src/browser/location/browser_platform_location.ts b/packages/platform-browser/src/browser/location/browser_platform_location.ts index 523ef0b8cf..a9708b16b0 100644 --- a/packages/platform-browser/src/browser/location/browser_platform_location.ts +++ b/packages/platform-browser/src/browser/location/browser_platform_location.ts @@ -23,8 +23,10 @@ import {supportsState} from './history'; */ @Injectable() export class BrowserPlatformLocation extends PlatformLocation { - public readonly location: Location; - private _history: History; + // TODO(issue/24571): remove '!'. + public readonly location !: Location; + // TODO(issue/24571): remove '!'. + private _history !: History; constructor(@Inject(DOCUMENT) private _doc: any) { super(); diff --git a/packages/platform-browser/src/dom/dom_adapter.ts b/packages/platform-browser/src/dom/dom_adapter.ts index 2cf70c64c0..5057f6dfbb 100644 --- a/packages/platform-browser/src/dom/dom_adapter.ts +++ b/packages/platform-browser/src/dom/dom_adapter.ts @@ -50,7 +50,8 @@ export abstract class DomAdapter { get attrToPropMap(): {[key: string]: string} { return this._attrToPropMap; } set attrToPropMap(value: {[key: string]: string}) { this._attrToPropMap = value; } /** @internal */ - _attrToPropMap: {[key: string]: string}; + // TODO(issue/24571): remove '!'. + _attrToPropMap !: {[key: string]: string}; abstract contains(nodeA: any, nodeB: any): boolean; abstract parse(templateHtml: string): any; diff --git a/packages/platform-browser/src/dom/events/event_manager.ts b/packages/platform-browser/src/dom/events/event_manager.ts index 42217b304f..f362b9c0d2 100644 --- a/packages/platform-browser/src/dom/events/event_manager.ts +++ b/packages/platform-browser/src/dom/events/event_manager.ts @@ -88,7 +88,8 @@ export class EventManager { export abstract class EventManagerPlugin { constructor(private _doc: any) {} - manager: EventManager; + // TODO(issue/24571): remove '!'. + manager !: EventManager; abstract supports(eventName: string): boolean; diff --git a/packages/platform-browser/test/browser/bootstrap_spec.ts b/packages/platform-browser/test/browser/bootstrap_spec.ts index f6e86df934..778e695f72 100644 --- a/packages/platform-browser/test/browser/bootstrap_spec.ts +++ b/packages/platform-browser/test/browser/bootstrap_spec.ts @@ -79,8 +79,9 @@ class HelloUrlCmp { @Directive({selector: '[someDir]', host: {'[title]': 'someDir'}}) class SomeDirective { + // TODO(issue/24571): remove '!'. @Input() - someDir: string; + someDir !: string; } @Pipe({name: 'somePipe'}) diff --git a/packages/platform-browser/test/testing_public_spec.ts b/packages/platform-browser/test/testing_public_spec.ts index 37c1121e65..c02f739f5e 100644 --- a/packages/platform-browser/test/testing_public_spec.ts +++ b/packages/platform-browser/test/testing_public_spec.ts @@ -86,8 +86,9 @@ class TestViewProvidersComp { @Directive({selector: '[someDir]', host: {'[title]': 'someDir'}}) class SomeDirective { + // TODO(issue/24571): remove '!'. @Input() - someDir: string; + someDir !: string; } @Pipe({name: 'somePipe'}) @@ -728,8 +729,9 @@ class CompWithUrlTemplate { class TestDir { constructor() { testDir = this; } + // TODO(issue/24571): remove '!'. @Input('test') - test: string; + test !: string; } TestBed.overrideTemplateUsingTestingModule( diff --git a/packages/platform-server/src/http.ts b/packages/platform-server/src/http.ts index 1fc55db209..58453a80ee 100644 --- a/packages/platform-server/src/http.ts +++ b/packages/platform-server/src/http.ts @@ -114,7 +114,8 @@ export abstract class ZoneMacroTaskWrapper { export class ZoneMacroTaskConnection extends ZoneMacroTaskWrapper implements Connection { response: Observable; - lastConnection: Connection; + // TODO(issue/24571): remove '!'. + lastConnection !: Connection; constructor(public request: Request, private backend: XHRBackend) { super(); diff --git a/packages/platform-server/test/integration_spec.ts b/packages/platform-server/test/integration_spec.ts index 311b4f52a7..3e7e8b2006 100644 --- a/packages/platform-server/test/integration_spec.ts +++ b/packages/platform-server/test/integration_spec.ts @@ -250,7 +250,8 @@ class NativeExampleModule { @Component({selector: 'my-child', template: 'Works!'}) class MyChildComponent { - @Input() public attr: boolean; + // TODO(issue/24571): remove '!'. + @Input() public attr !: boolean; } @Component({selector: 'app', template: ''}) diff --git a/packages/platform-webworker/src/web_workers/shared/post_message_bus.ts b/packages/platform-webworker/src/web_workers/shared/post_message_bus.ts index 4de44d4301..dfb01bc6e4 100644 --- a/packages/platform-webworker/src/web_workers/shared/post_message_bus.ts +++ b/packages/platform-webworker/src/web_workers/shared/post_message_bus.ts @@ -18,7 +18,8 @@ export interface PostMessageTarget { } export class PostMessageBusSink implements MessageBusSink { - private _zone: NgZone; + // TODO(issue/24571): remove '!'. + private _zone !: NgZone; private _channels: {[key: string]: _Channel} = {}; private _messageBuffer: Array = []; @@ -67,7 +68,8 @@ export class PostMessageBusSink implements MessageBusSink { } export class PostMessageBusSource implements MessageBusSource { - private _zone: NgZone; + // TODO(issue/24571): remove '!'. + private _zone !: NgZone; private _channels: {[key: string]: _Channel} = {}; constructor(eventTarget?: EventTarget) { diff --git a/packages/platform-webworker/src/web_workers/ui/renderer.ts b/packages/platform-webworker/src/web_workers/ui/renderer.ts index 84332b5202..6aceacd925 100644 --- a/packages/platform-webworker/src/web_workers/ui/renderer.ts +++ b/packages/platform-webworker/src/web_workers/ui/renderer.ts @@ -17,7 +17,8 @@ import {EventDispatcher} from '../ui/event_dispatcher'; @Injectable() export class MessageBasedRenderer2 { - private _eventDispatcher: EventDispatcher; + // TODO(issue/24571): remove '!'. + private _eventDispatcher !: EventDispatcher; constructor( private _brokerFactory: ServiceMessageBrokerFactory, private _bus: MessageBus, diff --git a/packages/platform-webworker/src/web_workers/worker/platform_location.ts b/packages/platform-webworker/src/web_workers/worker/platform_location.ts index 4322cad88a..63fe2c546b 100644 --- a/packages/platform-webworker/src/web_workers/worker/platform_location.ts +++ b/packages/platform-webworker/src/web_workers/worker/platform_location.ts @@ -21,7 +21,8 @@ export class WebWorkerPlatformLocation extends PlatformLocation { private _location: LocationType = null !; private _channelSource: EventEmitter; public initialized: Promise; - private initializedResolve: () => void; + // TODO(issue/24571): remove '!'. + private initializedResolve !: () => void; constructor( brokerFactory: ClientMessageBrokerFactory, bus: MessageBus, private _serializer: Serializer) { diff --git a/packages/platform-webworker/src/web_workers/worker/renderer.ts b/packages/platform-webworker/src/web_workers/worker/renderer.ts index 7c65abc9e7..45ec83a405 100644 --- a/packages/platform-webworker/src/web_workers/worker/renderer.ts +++ b/packages/platform-webworker/src/web_workers/worker/renderer.ts @@ -15,7 +15,8 @@ import {RenderStore} from '../shared/render_store'; import {Serializer, SerializerTypes} from '../shared/serializer'; export class NamedEventEmitter { - private _listeners: Map; + // TODO(issue/24571): remove '!'. + private _listeners !: Map; listen(eventName: string, callback: Function) { this._getListeners(eventName).push(callback); } diff --git a/packages/platform-webworker/src/worker_render.ts b/packages/platform-webworker/src/worker_render.ts index 889ca3359a..0fe5e41946 100644 --- a/packages/platform-webworker/src/worker_render.ts +++ b/packages/platform-webworker/src/worker_render.ts @@ -29,8 +29,10 @@ import {MessageBasedRenderer2} from './web_workers/ui/renderer'; */ @Injectable() export class WebWorkerInstance { - public worker: Worker; - public bus: MessageBus; + // TODO(issue/24571): remove '!'. + public worker !: Worker; + // TODO(issue/24571): remove '!'. + public bus !: MessageBus; /** @internal */ public init(worker: Worker, bus: MessageBus) { diff --git a/packages/platform-webworker/test/web_workers/shared/message_bus_util.ts b/packages/platform-webworker/test/web_workers/shared/message_bus_util.ts index 1ac193f2e1..5b14c33b7a 100644 --- a/packages/platform-webworker/test/web_workers/shared/message_bus_util.ts +++ b/packages/platform-webworker/test/web_workers/shared/message_bus_util.ts @@ -23,7 +23,8 @@ export function createConnectedMessageBus(): MessageBus { } class MockPostMessage { - private _listener: EventListener; + // TODO(issue/24571): remove '!'. + private _listener !: EventListener; addEventListener(type: string, listener: EventListener, useCapture?: boolean): void { if (type === 'message') { diff --git a/packages/router/src/directives/router_link.ts b/packages/router/src/directives/router_link.ts index 135585702a..4a34f4c414 100644 --- a/packages/router/src/directives/router_link.ts +++ b/packages/router/src/directives/router_link.ts @@ -92,14 +92,21 @@ import {UrlTree} from '../url_tree'; */ @Directive({selector: ':not(a)[routerLink]'}) export class RouterLink { - @Input() queryParams: {[k: string]: any}; - @Input() fragment: string; - @Input() queryParamsHandling: QueryParamsHandling; - @Input() preserveFragment: boolean; - @Input() skipLocationChange: boolean; - @Input() replaceUrl: boolean; + // TODO(issue/24571): remove '!'. + @Input() queryParams !: {[k: string]: any}; + // TODO(issue/24571): remove '!'. + @Input() fragment !: string; + // TODO(issue/24571): remove '!'. + @Input() queryParamsHandling !: QueryParamsHandling; + // TODO(issue/24571): remove '!'. + @Input() preserveFragment !: boolean; + // TODO(issue/24571): remove '!'. + @Input() skipLocationChange !: boolean; + // TODO(issue/24571): remove '!'. + @Input() replaceUrl !: boolean; private commands: any[] = []; - private preserve: boolean; + // TODO(issue/24571): remove '!'. + private preserve !: boolean; constructor( private router: Router, private route: ActivatedRoute, @@ -164,19 +171,28 @@ export class RouterLink { */ @Directive({selector: 'a[routerLink]'}) export class RouterLinkWithHref implements OnChanges, OnDestroy { - @HostBinding('attr.target') @Input() target: string; - @Input() queryParams: {[k: string]: any}; - @Input() fragment: string; - @Input() queryParamsHandling: QueryParamsHandling; - @Input() preserveFragment: boolean; - @Input() skipLocationChange: boolean; - @Input() replaceUrl: boolean; + // TODO(issue/24571): remove '!'. + @HostBinding('attr.target') @Input() target !: string; + // TODO(issue/24571): remove '!'. + @Input() queryParams !: {[k: string]: any}; + // TODO(issue/24571): remove '!'. + @Input() fragment !: string; + // TODO(issue/24571): remove '!'. + @Input() queryParamsHandling !: QueryParamsHandling; + // TODO(issue/24571): remove '!'. + @Input() preserveFragment !: boolean; + // TODO(issue/24571): remove '!'. + @Input() skipLocationChange !: boolean; + // TODO(issue/24571): remove '!'. + @Input() replaceUrl !: boolean; private commands: any[] = []; private subscription: Subscription; - private preserve: boolean; + // TODO(issue/24571): remove '!'. + private preserve !: boolean; // the url displayed on the anchor element. - @HostBinding() href: string; + // TODO(issue/24571): remove '!'. + @HostBinding() href !: string; constructor( private router: Router, private route: ActivatedRoute, diff --git a/packages/router/src/directives/router_link_active.ts b/packages/router/src/directives/router_link_active.ts index f30b66ba4e..2953fafc5a 100644 --- a/packages/router/src/directives/router_link_active.ts +++ b/packages/router/src/directives/router_link_active.ts @@ -78,9 +78,12 @@ import {RouterLink, RouterLinkWithHref} from './router_link'; }) export class RouterLinkActive implements OnChanges, OnDestroy, AfterContentInit { - @ContentChildren(RouterLink, {descendants: true}) links: QueryList; + // TODO(issue/24571): remove '!'. + @ContentChildren(RouterLink, {descendants: true}) + links !: QueryList; + // TODO(issue/24571): remove '!'. @ContentChildren(RouterLinkWithHref, {descendants: true}) - linksWithHrefs: QueryList; + linksWithHrefs !: QueryList; private classes: string[] = []; private subscription: Subscription; diff --git a/packages/router/src/router.ts b/packages/router/src/router.ts index f68be1ba97..bbdd53a315 100644 --- a/packages/router/src/router.ts +++ b/packages/router/src/router.ts @@ -214,7 +214,8 @@ export class Router { private rawUrlTree: UrlTree; private navigations = new BehaviorSubject(null !); - private locationSubscription: Subscription; + // TODO(issue/24571): remove '!'. + private locationSubscription !: Subscription; private navigationId: number = 0; private configLoader: RouterConfigLoader; private ngModule: NgModuleRef; diff --git a/packages/router/src/router_preloader.ts b/packages/router/src/router_preloader.ts index 67f4465abe..712f212c47 100644 --- a/packages/router/src/router_preloader.ts +++ b/packages/router/src/router_preloader.ts @@ -72,7 +72,8 @@ export class NoPreloading implements PreloadingStrategy { @Injectable() export class RouterPreloader implements OnDestroy { private loader: RouterConfigLoader; - private subscription: Subscription; + // TODO(issue/24571): remove '!'. + private subscription !: Subscription; constructor( private router: Router, moduleLoader: NgModuleFactoryLoader, compiler: Compiler, diff --git a/packages/router/src/router_scroller.ts b/packages/router/src/router_scroller.ts index 7d3dc4b90d..15a2393265 100644 --- a/packages/router/src/router_scroller.ts +++ b/packages/router/src/router_scroller.ts @@ -14,8 +14,10 @@ import {NavigationEnd, NavigationStart, Scroll} from './events'; import {Router} from './router'; export class RouterScroller implements OnDestroy { - private routerEventsSubscription: Unsubscribable; - private scrollEventsSubscription: Unsubscribable; + // TODO(issue/24571): remove '!'. + private routerEventsSubscription !: Unsubscribable; + // TODO(issue/24571): remove '!'. + private scrollEventsSubscription !: Unsubscribable; private lastId = 0; private lastSource: 'imperative'|'popstate'|'hashchange'|undefined = 'imperative'; diff --git a/packages/router/src/router_state.ts b/packages/router/src/router_state.ts index 0afb6870d4..658e74e9f0 100644 --- a/packages/router/src/router_state.ts +++ b/packages/router/src/router_state.ts @@ -106,15 +106,19 @@ export function createEmptyStateSnapshot( */ export class ActivatedRoute { /** The current snapshot of this route */ - snapshot: ActivatedRouteSnapshot; + // TODO(issue/24571): remove '!'. + snapshot !: ActivatedRouteSnapshot; /** @internal */ _futureSnapshot: ActivatedRouteSnapshot; /** @internal */ - _routerState: RouterState; + // TODO(issue/24571): remove '!'. + _routerState !: RouterState; /** @internal */ - _paramMap: Observable; + // TODO(issue/24571): remove '!'. + _paramMap !: Observable; /** @internal */ - _queryParamMap: Observable; + // TODO(issue/24571): remove '!'. + _queryParamMap !: Observable; /** @internal */ constructor( @@ -257,13 +261,17 @@ export class ActivatedRouteSnapshot { /** @internal */ _resolve: ResolveData; /** @internal */ - _resolvedData: Data; + // TODO(issue/24571): remove '!'. + _resolvedData !: Data; /** @internal */ - _routerState: RouterStateSnapshot; + // TODO(issue/24571): remove '!'. + _routerState !: RouterStateSnapshot; /** @internal */ - _paramMap: ParamMap; + // TODO(issue/24571): remove '!'. + _paramMap !: ParamMap; /** @internal */ - _queryParamMap: ParamMap; + // TODO(issue/24571): remove '!'. + _queryParamMap !: ParamMap; /** @internal */ constructor( diff --git a/packages/router/src/url_tree.ts b/packages/router/src/url_tree.ts index c9b4101793..3ba437ff68 100644 --- a/packages/router/src/url_tree.ts +++ b/packages/router/src/url_tree.ts @@ -104,7 +104,8 @@ function containsSegmentGroupHelper( */ export class UrlTree { /** @internal */ - _queryParamMap: ParamMap; + // TODO(issue/24571): remove '!'. + _queryParamMap !: ParamMap; /** @internal */ constructor( @@ -137,9 +138,11 @@ export class UrlTree { */ export class UrlSegmentGroup { /** @internal */ - _sourceSegment: UrlSegmentGroup; + // TODO(issue/24571): remove '!'. + _sourceSegment !: UrlSegmentGroup; /** @internal */ - _segmentIndexShift: number; + // TODO(issue/24571): remove '!'. + _segmentIndexShift !: number; /** The parent node in the url tree */ parent: UrlSegmentGroup|null = null; @@ -189,7 +192,8 @@ export class UrlSegmentGroup { */ export class UrlSegment { /** @internal */ - _parameterMap: ParamMap; + // TODO(issue/24571): remove '!'. + _parameterMap !: ParamMap; constructor( /** The path part of a URL segment */ diff --git a/packages/router/test/regression_integration.spec.ts b/packages/router/test/regression_integration.spec.ts index d59c2c36d2..ab1d0681be 100644 --- a/packages/router/test/regression_integration.spec.ts +++ b/packages/router/test/regression_integration.spec.ts @@ -73,8 +73,10 @@ describe('Integration', () => { ` }) class ComponentWithRouterLink { - @ViewChild(TemplateRef) templateRef: TemplateRef; - @ViewChild('container', {read: ViewContainerRef}) container: ViewContainerRef; + // TODO(issue/24571): remove '!'. + @ViewChild(TemplateRef) templateRef !: TemplateRef; + // TODO(issue/24571): remove '!'. + @ViewChild('container', {read: ViewContainerRef}) container !: ViewContainerRef; addLink() { this.container.createEmbeddedView(this.templateRef, {$implicit: '/simple'}); diff --git a/packages/service-worker/cli/tsconfig.json b/packages/service-worker/cli/tsconfig.json index 09c1527352..03305d9b4d 100644 --- a/packages/service-worker/cli/tsconfig.json +++ b/packages/service-worker/cli/tsconfig.json @@ -6,6 +6,7 @@ "module": "es2015", "moduleResolution": "node", "strictNullChecks": true, + "strictPropertyInitialization": true, "outDir": "../../../dist/all/@angular/service-worker/cli-custom", "noImplicitAny": true, "noFallthroughCasesInSwitch": true, diff --git a/packages/service-worker/src/push.ts b/packages/service-worker/src/push.ts index 9ea4cef004..2a9f244c79 100644 --- a/packages/service-worker/src/push.ts +++ b/packages/service-worker/src/push.ts @@ -23,7 +23,8 @@ export class SwPush { readonly messages: Observable; readonly subscription: Observable; - private pushManager: Observable; + // TODO(issue/24571): remove '!'. + private pushManager !: Observable; private subscriptionChanges: Subject = new Subject(); diff --git a/packages/service-worker/worker/testing/mock.ts b/packages/service-worker/worker/testing/mock.ts index bcdde49258..00f5b6d053 100644 --- a/packages/service-worker/worker/testing/mock.ts +++ b/packages/service-worker/worker/testing/mock.ts @@ -95,7 +95,8 @@ export class MockServerState { private requests: Request[] = []; private gate: Promise = Promise.resolve(); private resolve: Function|null = null; - private resolveNextRequest: Function; + // TODO(issue/24571): remove '!'. + private resolveNextRequest !: Function; online = true; nextRequest: Promise; diff --git a/packages/service-worker/worker/testing/scope.ts b/packages/service-worker/worker/testing/scope.ts index cb647c76dd..3c648e382a 100644 --- a/packages/service-worker/worker/testing/scope.ts +++ b/packages/service-worker/worker/testing/scope.ts @@ -79,7 +79,8 @@ export class SwTestHarness implements ServiceWorkerGlobalScope, Adapter, Context private skippedWaiting = true; private selfMessageQueue: any[] = []; - unregistered: boolean; + // TODO(issue/24571): remove '!'. + unregistered !: boolean; readonly notifications: {title: string, options: Object}[] = []; readonly registration: ServiceWorkerRegistration = { active: { diff --git a/packages/service-worker/worker/tsconfig.json b/packages/service-worker/worker/tsconfig.json index e74e7ed7a0..c165ab4e8c 100644 --- a/packages/service-worker/worker/tsconfig.json +++ b/packages/service-worker/worker/tsconfig.json @@ -6,6 +6,7 @@ "module": "es2015", "moduleResolution": "node", "strictNullChecks": true, + "strictPropertyInitialization": true, "outDir": "../../../dist/all/@angular/service-worker/worker-es2017", "noImplicitAny": true, "noFallthroughCasesInSwitch": true, diff --git a/packages/tsconfig-build.json b/packages/tsconfig-build.json index d3334472cc..4979b6563f 100644 --- a/packages/tsconfig-build.json +++ b/packages/tsconfig-build.json @@ -9,6 +9,7 @@ "stripInternal": true, "noImplicitAny": true, "strictNullChecks": true, + "strictPropertyInitialization": true, "noFallthroughCasesInSwitch": true, "moduleResolution": "node", "module": "es2015", diff --git a/packages/tsconfig.json b/packages/tsconfig.json index 162991e17b..fd47b5b67d 100644 --- a/packages/tsconfig.json +++ b/packages/tsconfig.json @@ -7,6 +7,7 @@ "module": "commonjs", "moduleResolution": "node", "strictNullChecks": true, + "strictPropertyInitialization": true, "outDir": "../dist/all/@angular", "noImplicitAny": true, "noFallthroughCasesInSwitch": true, diff --git a/packages/upgrade/src/common/component_info.ts b/packages/upgrade/src/common/component_info.ts index 898bb72456..1eab41fd65 100644 --- a/packages/upgrade/src/common/component_info.ts +++ b/packages/upgrade/src/common/component_info.ts @@ -13,12 +13,18 @@ * and attribute have the same identifier. */ export class PropertyBinding { - bracketAttr: string; - bracketParenAttr: string; - parenAttr: string; - onAttr: string; - bindAttr: string; - bindonAttr: string; + // TODO(issue/24571): remove '!'. + bracketAttr !: string; + // TODO(issue/24571): remove '!'. + bracketParenAttr !: string; + // TODO(issue/24571): remove '!'. + parenAttr !: string; + // TODO(issue/24571): remove '!'. + onAttr !: string; + // TODO(issue/24571): remove '!'. + bindAttr !: string; + // TODO(issue/24571): remove '!'. + bindonAttr !: string; constructor(public prop: string, public attr: string) { this.parseBinding(); } diff --git a/packages/upgrade/src/common/downgrade_component.ts b/packages/upgrade/src/common/downgrade_component.ts index d87161e203..8dd26698b5 100644 --- a/packages/upgrade/src/common/downgrade_component.ts +++ b/packages/upgrade/src/common/downgrade_component.ts @@ -158,7 +158,8 @@ export function downgradeComponent(info: { * to preserve the synchronous nature of Angular 1's $compile. */ class ParentInjectorPromise { - private injector: Injector; + // TODO(issue/24571): remove '!'. + private injector !: Injector; private injectorKey: string = controllerKey(INJECTOR_KEY); private callbacks: ((injector: Injector) => any)[] = []; diff --git a/packages/upgrade/src/common/downgrade_component_adapter.ts b/packages/upgrade/src/common/downgrade_component_adapter.ts index fd20b79e0a..bc41baba81 100644 --- a/packages/upgrade/src/common/downgrade_component_adapter.ts +++ b/packages/upgrade/src/common/downgrade_component_adapter.ts @@ -22,10 +22,13 @@ export class DowngradeComponentAdapter { private inputChangeCount: number = 0; private inputChanges: SimpleChanges = {}; private componentScope: angular.IScope; - private componentRef: ComponentRef; + // TODO(issue/24571): remove '!'. + private componentRef !: ComponentRef; private component: any; - private changeDetector: ChangeDetectorRef; - private viewChangeDetector: ChangeDetectorRef; + // TODO(issue/24571): remove '!'. + private changeDetector !: ChangeDetectorRef; + // TODO(issue/24571): remove '!'. + private viewChangeDetector !: ChangeDetectorRef; constructor( private element: angular.IAugmentedJQuery, private attrs: angular.IAttributes, diff --git a/packages/upgrade/src/common/util.ts b/packages/upgrade/src/common/util.ts index 0407753b10..d505aec20c 100644 --- a/packages/upgrade/src/common/util.ts +++ b/packages/upgrade/src/common/util.ts @@ -43,8 +43,10 @@ export function isFunction(value: any): value is Function { export class Deferred { promise: Promise; - resolve: (value?: R|PromiseLike) => void; - reject: (error?: any) => void; + // TODO(issue/24571): remove '!'. + resolve !: (value?: R | PromiseLike) => void; + // TODO(issue/24571): remove '!'. + reject !: (error?: any) => void; constructor() { this.promise = new Promise((res, rej) => { diff --git a/packages/upgrade/src/dynamic/upgrade_adapter.ts b/packages/upgrade/src/dynamic/upgrade_adapter.ts index 6bacc19591..0ce767c1f0 100644 --- a/packages/upgrade/src/dynamic/upgrade_adapter.ts +++ b/packages/upgrade/src/dynamic/upgrade_adapter.ts @@ -112,10 +112,13 @@ export class UpgradeAdapter { */ private ng1ComponentsToBeUpgraded: {[name: string]: UpgradeNg1ComponentAdapterBuilder} = {}; private upgradedProviders: StaticProvider[] = []; - private ngZone: NgZone; - private ng1Module: angular.IModule; + // TODO(issue/24571): remove '!'. + private ngZone !: NgZone; + // TODO(issue/24571): remove '!'. + private ng1Module !: angular.IModule; private moduleRef: NgModuleRef|null = null; - private ng2BootstrapDeferred: Deferred; + // TODO(issue/24571): remove '!'. + private ng2BootstrapDeferred !: Deferred; constructor(private ng2AppModule: Type, private compilerOptions?: CompilerOptions) { if (!ng2AppModule) { @@ -608,7 +611,8 @@ export class UpgradeAdapter { * to preserve the synchronous nature of AngularJS's $compile. */ class ParentInjectorPromise { - private injector: Injector; + // TODO(issue/24571): remove '!'. + private injector !: Injector; private callbacks: ((injector: Injector) => any)[] = []; constructor(private element: angular.IAugmentedJQuery) { diff --git a/packages/upgrade/src/dynamic/upgrade_ng1_adapter.ts b/packages/upgrade/src/dynamic/upgrade_ng1_adapter.ts index 81f21e6a1c..ffee28a0bf 100644 --- a/packages/upgrade/src/dynamic/upgrade_ng1_adapter.ts +++ b/packages/upgrade/src/dynamic/upgrade_ng1_adapter.ts @@ -22,7 +22,8 @@ const NOT_SUPPORTED: any = 'NOT_SUPPORTED'; export class UpgradeNg1ComponentAdapterBuilder { - type: Type; + // TODO(issue/24571): remove '!'. + type !: Type; inputs: string[] = []; inputsRename: string[] = []; outputs: string[] = []; @@ -31,7 +32,8 @@ export class UpgradeNg1ComponentAdapterBuilder { checkProperties: string[] = []; propertyMap: {[name: string]: string} = {}; directive: angular.IDirective|null = null; - template: string; + // TODO(issue/24571): remove '!'. + template !: string; constructor(public name: string) { const selector = @@ -45,7 +47,8 @@ export class UpgradeNg1ComponentAdapterBuilder { @Directive(directive) class MyClass { - directive: angular.IDirective; + // TODO(issue/24571): remove '!'. + directive !: angular.IDirective; constructor( @Inject($SCOPE) scope: angular.IScope, injector: Injector, elementRef: ElementRef) { const helper = new UpgradeHelper(injector, name, elementRef, this.directive); diff --git a/packages/upgrade/src/static/upgrade_component.ts b/packages/upgrade/src/static/upgrade_component.ts index 009482db2e..3976a1fa47 100644 --- a/packages/upgrade/src/static/upgrade_component.ts +++ b/packages/upgrade/src/static/upgrade_component.ts @@ -76,14 +76,19 @@ export class UpgradeComponent implements OnInit, OnChanges, DoCheck, OnDestroy { private directive: angular.IDirective; private bindings: Bindings; - private controllerInstance: IControllerInstance; - private bindingDestination: IBindingDestination; + // TODO(issue/24571): remove '!'. + private controllerInstance !: IControllerInstance; + // TODO(issue/24571): remove '!'. + private bindingDestination !: IBindingDestination; - // We will be instantiating the controller in the `ngOnInit` hook, when the first `ngOnChanges` - // will have been already triggered. We store the `SimpleChanges` and "play them back" later. - private pendingChanges: SimpleChanges|null; + // We will be instantiating the controller in the `ngOnInit` hook, when the + // first `ngOnChanges` will have been already triggered. We store the + // `SimpleChanges` and "play them back" later. + // TODO(issue/24571): remove '!'. + private pendingChanges !: SimpleChanges | null; - private unregisterDoCheckWatcher: Function; + // TODO(issue/24571): remove '!'. + private unregisterDoCheckWatcher !: Function; /** * Create a new `UpgradeComponent` instance. You should not normally need to do this. diff --git a/packages/upgrade/test/common/downgrade_component_adapter_spec.ts b/packages/upgrade/test/common/downgrade_component_adapter_spec.ts index c428c24bd8..eb3cc0683a 100644 --- a/packages/upgrade/test/common/downgrade_component_adapter_spec.ts +++ b/packages/upgrade/test/common/downgrade_component_adapter_spec.ts @@ -110,13 +110,18 @@ withEachNg1Version(() => { $evalAsync(exp: angular.Ng1Expression, locals?: any) { return () => {}; } - $$childTail: angular.IScope; - $$childHead: angular.IScope; - $$nextSibling: angular.IScope; + // TODO(issue/24571): remove '!'. + $$childTail !: angular.IScope; + // TODO(issue/24571): remove '!'. + $$childHead !: angular.IScope; + // TODO(issue/24571): remove '!'. + $$nextSibling !: angular.IScope; [key: string]: any; $id = 'mockScope'; - $parent: angular.IScope; - $root: angular.IScope; + // TODO(issue/24571): remove '!'. + $parent !: angular.IScope; + // TODO(issue/24571): remove '!'. + $root !: angular.IScope; } function getAdaptor(): DowngradeComponentAdapter { diff --git a/packages/upgrade/test/dynamic/upgrade_spec.ts b/packages/upgrade/test/dynamic/upgrade_spec.ts index 159f05c4ae..c99717d826 100644 --- a/packages/upgrade/test/dynamic/upgrade_spec.ts +++ b/packages/upgrade/test/dynamic/upgrade_spec.ts @@ -217,7 +217,8 @@ withEachNg1Version(() => { @Component({selector: 'my-app', template: ''}) class AppComponent { - value: number; + // TODO(issue/24571): remove '!'. + value !: number; constructor() { appComponent = this; } } @@ -226,7 +227,8 @@ withEachNg1Version(() => { template: '
{{valueFromPromise}}', }) class ChildComponent { - valueFromPromise: number; + // TODO(issue/24571): remove '!'. + valueFromPromise !: number; @Input() set value(v: number) { expect(NgZone.isInAngularZone()).toBe(true); } @@ -496,8 +498,10 @@ withEachNg1Version(() => { class Ng2Component implements OnChanges { ngOnChangesCount = 0; firstChangesCount = 0; - initialValue: string; - @Input() foo: string; + // TODO(issue/24571): remove '!'. + initialValue !: string; + // TODO(issue/24571): remove '!'. + @Input() foo !: string; ngOnChanges(changes: SimpleChanges) { this.ngOnChangesCount++; @@ -742,7 +746,8 @@ withEachNg1Version(() => { it('should correctly project structural directives', async(() => { @Component({selector: 'ng2', template: 'ng2-{{ itemId }}()'}) class Ng2Component { - @Input() itemId: string; + // TODO(issue/24571): remove '!'. + @Input() itemId !: string; } @NgModule({imports: [BrowserModule], declarations: [Ng2Component]}) diff --git a/packages/upgrade/test/static/integration/change_detection_spec.ts b/packages/upgrade/test/static/integration/change_detection_spec.ts index affa2cd02b..b01649f92c 100644 --- a/packages/upgrade/test/static/integration/change_detection_spec.ts +++ b/packages/upgrade/test/static/integration/change_detection_spec.ts @@ -80,7 +80,8 @@ withEachNg1Version(() => { @Component({selector: 'my-app', template: ''}) class AppComponent { - value: number; + // TODO(issue/24571): remove '!'. + value !: number; constructor() { appComponent = this; } } @@ -89,7 +90,8 @@ withEachNg1Version(() => { template: '
{{ valueFromPromise }}
', }) class ChildComponent { - valueFromPromise: number; + // TODO(issue/24571): remove '!'. + valueFromPromise !: number; @Input() set value(v: number) { expect(NgZone.isInAngularZone()).toBe(true); } diff --git a/packages/upgrade/test/static/integration/content_projection_spec.ts b/packages/upgrade/test/static/integration/content_projection_spec.ts index 6eea5ceb64..00b21ad536 100644 --- a/packages/upgrade/test/static/integration/content_projection_spec.ts +++ b/packages/upgrade/test/static/integration/content_projection_spec.ts @@ -60,7 +60,8 @@ withEachNg1Version(() => { it('should correctly project structural directives', async(() => { @Component({selector: 'ng2', template: 'ng2-{{ itemId }}()'}) class Ng2Component { - @Input() itemId: string; + // TODO(issue/24571): remove '!'. + @Input() itemId !: string; } @NgModule({ diff --git a/packages/upgrade/test/static/integration/downgrade_component_spec.ts b/packages/upgrade/test/static/integration/downgrade_component_spec.ts index 810d604c34..cff3718529 100644 --- a/packages/upgrade/test/static/integration/downgrade_component_spec.ts +++ b/packages/upgrade/test/static/integration/downgrade_component_spec.ts @@ -418,8 +418,10 @@ withEachNg1Version(() => { class Ng2Component implements OnChanges { ngOnChangesCount = 0; firstChangesCount = 0; - initialValue: string; - @Input() foo: string; + // TODO(issue/24571): remove '!'. + initialValue !: string; + // TODO(issue/24571): remove '!'. + @Input() foo !: string; ngOnChanges(changes: SimpleChanges) { this.ngOnChangesCount++; diff --git a/packages/upgrade/test/static/integration/examples_spec.ts b/packages/upgrade/test/static/integration/examples_spec.ts index 9266a8ced7..3a0989432c 100644 --- a/packages/upgrade/test/static/integration/examples_spec.ts +++ b/packages/upgrade/test/static/integration/examples_spec.ts @@ -29,7 +29,8 @@ withEachNg1Version(() => { // component @Directive({selector: 'ng1'}) class Ng1Component extends UpgradeComponent { - @Input() title: string; + // TODO(issue/24571): remove '!'. + @Input() title !: string; constructor(elementRef: ElementRef, injector: Injector) { super('ng1', elementRef, injector); @@ -42,7 +43,8 @@ withEachNg1Version(() => { template: 'ng2[transclude]()' }) class Ng2Component { - @Input('name') nameProp: string; + // TODO(issue/24571): remove '!'. + @Input('name') nameProp !: string; } // This module represents the Angular pieces of the application diff --git a/packages/upgrade/test/static/integration/upgrade_component_spec.ts b/packages/upgrade/test/static/integration/upgrade_component_spec.ts index 58d07514bc..9c0ee94db2 100644 --- a/packages/upgrade/test/static/integration/upgrade_component_spec.ts +++ b/packages/upgrade/test/static/integration/upgrade_component_spec.ts @@ -476,8 +476,10 @@ withEachNg1Version(() => { // Define `Ng1ComponentFacade` @Directive({selector: 'ng1'}) class Ng1ComponentFacade extends UpgradeComponent { - @Input('inputAttrA') inputA: string; - @Input() inputB: string; + // TODO(issue/24571): remove '!'. + @Input('inputAttrA') inputA !: string; + // TODO(issue/24571): remove '!'. + @Input() inputB !: string; constructor(elementRef: ElementRef, injector: Injector) { super('ng1', elementRef, injector); @@ -551,8 +553,10 @@ withEachNg1Version(() => { // Define `Ng1ComponentFacade` @Directive({selector: 'ng1'}) class Ng1ComponentFacade extends UpgradeComponent { - @Input('inputAttrA') inputA: string; - @Input() inputB: string; + // TODO(issue/24571): remove '!'. + @Input('inputAttrA') inputA !: string; + // TODO(issue/24571): remove '!'. + @Input() inputB !: string; constructor(elementRef: ElementRef, injector: Injector) { super('ng1', elementRef, injector); @@ -626,10 +630,14 @@ withEachNg1Version(() => { // Define `Ng1ComponentFacade` @Directive({selector: 'ng1'}) class Ng1ComponentFacade extends UpgradeComponent { - @Input('inputAttrA') inputA: string; - @Output('inputAttrAChange') inputAChange: EventEmitter; - @Input() inputB: string; - @Output() inputBChange: EventEmitter; + // TODO(issue/24571): remove '!'. + @Input('inputAttrA') inputA !: string; + // TODO(issue/24571): remove '!'. + @Output('inputAttrAChange') inputAChange !: EventEmitter; + // TODO(issue/24571): remove '!'. + @Input() inputB !: string; + // TODO(issue/24571): remove '!'. + @Output() inputBChange !: EventEmitter; constructor(elementRef: ElementRef, injector: Injector) { super('ng1', elementRef, injector); @@ -701,8 +709,10 @@ withEachNg1Version(() => { // Define `Ng1ComponentFacade` @Directive({selector: 'ng1'}) class Ng1ComponentFacade extends UpgradeComponent { - @Output('outputAttrA') outputA: EventEmitter; - @Output() outputB: EventEmitter; + // TODO(issue/24571): remove '!'. + @Output('outputAttrA') outputA !: EventEmitter; + // TODO(issue/24571): remove '!'. + @Output() outputB !: EventEmitter; constructor(elementRef: ElementRef, injector: Injector) { super('ng1', elementRef, injector); @@ -783,13 +793,17 @@ withEachNg1Version(() => { // Define `Ng1ComponentFacade` @Directive({selector: 'ng1'}) class Ng1ComponentFacade extends UpgradeComponent { - @Input() fullName: string; + // TODO(issue/24571): remove '!'. + @Input() fullName !: string; @Input('dataA') modelA: any; @Input('dataB') modelB: any; - @Output('dataBChange') modelBChange: EventEmitter; + // TODO(issue/24571): remove '!'. + @Output('dataBChange') modelBChange !: EventEmitter; @Input() modelC: any; - @Output() modelCChange: EventEmitter; - @Output() event: EventEmitter; + // TODO(issue/24571): remove '!'. + @Output() modelCChange !: EventEmitter; + // TODO(issue/24571): remove '!'. + @Output() event !: EventEmitter; constructor(elementRef: ElementRef, injector: Injector) { super('ng1', elementRef, injector); @@ -862,12 +876,18 @@ withEachNg1Version(() => { // Define `Ng1ComponentFacade` @Directive({selector: 'ng1'}) class Ng1ComponentFacade extends UpgradeComponent { - @Input('inputAttrA') inputA: string; - @Output('inputAttrAChange') inputAChange: EventEmitter; - @Input() inputB: string; - @Output() inputBChange: EventEmitter; - @Output('outputAttrA') outputA: EventEmitter; - @Output() outputB: EventEmitter; + // TODO(issue/24571): remove '!'. + @Input('inputAttrA') inputA !: string; + // TODO(issue/24571): remove '!'. + @Output('inputAttrAChange') inputAChange !: EventEmitter; + // TODO(issue/24571): remove '!'. + @Input() inputB !: string; + // TODO(issue/24571): remove '!'. + @Output() inputBChange !: EventEmitter; + // TODO(issue/24571): remove '!'. + @Output('outputAttrA') outputA !: EventEmitter; + // TODO(issue/24571): remove '!'. + @Output() outputB !: EventEmitter; constructor(elementRef: ElementRef, injector: Injector) { super('ng1', elementRef, injector); @@ -957,9 +977,12 @@ withEachNg1Version(() => { // Define `Ng1ComponentFacade` @Directive({selector: '[ng1]'}) class Ng1ComponentFacade extends UpgradeComponent { - @Input() inputA: string; - @Output() inputAChange: EventEmitter; - @Output() outputA: EventEmitter; + // TODO(issue/24571): remove '!'. + @Input() inputA !: string; + // TODO(issue/24571): remove '!'. + @Output() inputAChange !: EventEmitter; + // TODO(issue/24571): remove '!'. + @Output() outputA !: EventEmitter; constructor(elementRef: ElementRef, injector: Injector) { super('ng1', elementRef, injector); @@ -1319,7 +1342,9 @@ withEachNg1Version(() => { scope: true, controllerAs: 'vm', controller: class { - hasElement: string; isClass: string; scope: string; + hasElement: string; // TODO(issue/24571): remove '!'. + isClass !: string; + scope: string; constructor(public $element: angular.IAugmentedJQuery, $scope: angular.IScope) { this.hasElement = $element[0].nodeName; @@ -1393,7 +1418,8 @@ withEachNg1Version(() => { // Define `Ng1ComponentFacade` @Directive({selector: 'ng1A'}) class Ng1ComponentAFacade extends UpgradeComponent { - @Input() title: string; + // TODO(issue/24571): remove '!'. + @Input() title !: string; constructor(elementRef: ElementRef, injector: Injector) { super('ng1A', elementRef, injector); @@ -1402,7 +1428,8 @@ withEachNg1Version(() => { @Directive({selector: 'ng1B'}) class Ng1ComponentBFacade extends UpgradeComponent { - @Input() title: string; + // TODO(issue/24571): remove '!'. + @Input() title !: string; constructor(elementRef: ElementRef, injector: Injector) { super('ng1B', elementRef, injector); @@ -1459,7 +1486,8 @@ withEachNg1Version(() => { // Define `Ng1ComponentFacade` @Directive({selector: 'ng1'}) class Ng1ComponentFacade extends UpgradeComponent { - @Input() title: string; + // TODO(issue/24571): remove '!'. + @Input() title !: string; constructor(elementRef: ElementRef, injector: Injector) { super('ng1', elementRef, injector); @@ -1508,7 +1536,8 @@ withEachNg1Version(() => { // Define `Ng1ComponentFacade` @Directive({selector: 'ng1'}) class Ng1ComponentFacade extends UpgradeComponent { - @Input() title: string; + // TODO(issue/24571): remove '!'. + @Input() title !: string; constructor(elementRef: ElementRef, injector: Injector) { super('ng1', elementRef, injector); @@ -3336,7 +3365,8 @@ withEachNg1Version(() => { @Component( {selector: 'ng2', template: '
|
'}) class Ng2Component { - @Input() show: boolean; + // TODO(issue/24571): remove '!'. + @Input() show !: boolean; } // Define `ng1Module` @@ -3436,7 +3466,8 @@ withEachNg1Version(() => { @Component( {selector: 'ng2', template: '
|
'}) class Ng2Component { - @Input() show: boolean; + // TODO(issue/24571): remove '!'. + @Input() show !: boolean; } // Define `ng1Module` @@ -3720,7 +3751,8 @@ withEachNg1Version(() => { // Define `ng1Component` class Ng1ControllerX { - ng1XInputA: string; + // TODO(issue/24571): remove '!'. + ng1XInputA !: string; ng1XInputB: any; ng1XInputC: any; @@ -3748,12 +3780,16 @@ withEachNg1Version(() => { // Define `Ng1ComponentFacade` @Directive({selector: 'ng1X'}) class Ng1ComponentXFacade extends UpgradeComponent { - @Input() ng1XInputA: string; + // TODO(issue/24571): remove '!'. + @Input() ng1XInputA !: string; @Input() ng1XInputB: any; @Input() ng1XInputC: any; - @Output() ng1XInputCChange: EventEmitter; - @Output() ng1XOutputA: EventEmitter; - @Output() ng1XOutputB: EventEmitter; + // TODO(issue/24571): remove '!'. + @Output() ng1XInputCChange !: EventEmitter; + // TODO(issue/24571): remove '!'. + @Output() ng1XOutputA !: EventEmitter; + // TODO(issue/24571): remove '!'. + @Output() ng1XOutputB !: EventEmitter; constructor(elementRef: ElementRef, injector: Injector) { super('ng1X', elementRef, injector);