Skip to content

Commit 03e855a

Browse files
alexeaglemhevery
authored andcommitted
build: allow users to specify --strictNullChecks (angular#14382)
PR Close angular#14382
1 parent 96073e5 commit 03e855a

File tree

8 files changed

+72
-54
lines changed

8 files changed

+72
-54
lines changed

integration/hello_world__closure/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"compilerOptions": {
88
"module": "es2015",
99
"moduleResolution": "node",
10+
"strictNullChecks": true,
1011
"target": "es6",
1112
"noImplicitAny": false,
1213
"sourceMap": false,

integration/typings_test_ts21/tsconfig.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
"rootDir": ".",
99
"target": "es5",
1010
"lib": ["es5", "dom", "es2015.collection", "es2015.iterable", "es2015.promise"],
11-
"types": []
11+
"types": [],
12+
"strictNullChecks": true
1213
},
1314
"files": [
1415
"include-all.ts",

modules/@angular/core/src/core_private_export.ts

Lines changed: 47 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -48,60 +48,77 @@ import * as viewEngine from './view/index';
4848
export const __core_private__: {
4949
isDefaultChangeDetectionStrategy: typeof constants.isDefaultChangeDetectionStrategy,
5050
ChangeDetectorStatus: typeof constants.ChangeDetectorStatus,
51-
_ChangeDetectorStatus?: constants.ChangeDetectorStatus,
51+
_ChangeDetectorStatus: constants.ChangeDetectorStatus,
5252
constructDependencies: typeof reflective_provider.constructDependencies,
5353
LifecycleHooks: typeof lifecycle_hooks.LifecycleHooks,
54-
_LifecycleHooks?: lifecycle_hooks.LifecycleHooks,
54+
_LifecycleHooks: lifecycle_hooks.LifecycleHooks,
5555
LIFECYCLE_HOOKS_VALUES: typeof lifecycle_hooks.LIFECYCLE_HOOKS_VALUES,
5656
ReflectorReader: typeof reflector_reader.ReflectorReader,
57-
_ReflectorReader?: reflector_reader.ReflectorReader,
58-
_SetterFn?: reflection_types.SetterFn;
59-
_GetterFn?: reflection_types.GetterFn;
60-
_MethodFn?: reflection_types.MethodFn;
57+
_ReflectorReader: reflector_reader.ReflectorReader,
58+
_SetterFn: reflection_types.SetterFn;
59+
_GetterFn: reflection_types.GetterFn;
60+
_MethodFn: reflection_types.MethodFn;
6161
CodegenComponentFactoryResolver:
6262
typeof component_factory_resolver.CodegenComponentFactoryResolver,
6363
ComponentRef_: typeof component_factory.ComponentRef_,
64-
_CodegenComponentFactoryResolver?: component_factory_resolver.CodegenComponentFactoryResolver,
65-
ViewContainer: typeof view_container.ViewContainer, _ViewContainer?: view_container.ViewContainer,
66-
AppView: typeof view.AppView, _AppView?: view.AppView<any>,
67-
DebugAppView: typeof view.DebugAppView, _DebugAppView?: view.DebugAppView<any>,
64+
_CodegenComponentFactoryResolver: component_factory_resolver.CodegenComponentFactoryResolver,
65+
ViewContainer: typeof view_container.ViewContainer,
66+
_ViewContainer: view_container.ViewContainer,
67+
AppView: typeof view.AppView,
68+
_AppView: view.AppView<any>,
69+
DebugAppView: typeof view.DebugAppView,
70+
_DebugAppView: view.DebugAppView<any>,
6871
NgModuleInjector: typeof ng_module_factory.NgModuleInjector,
69-
_NgModuleInjector?: ng_module_factory.NgModuleInjector<any>,
72+
_NgModuleInjector: ng_module_factory.NgModuleInjector<any>,
7073
registerModuleFactory: typeof ng_module_factory_loader.registerModuleFactory,
71-
ViewType: typeof view_type.ViewType, _ViewType?: view_type.ViewType,
72-
ViewMetadata: typeof metadata_view.ViewMetadata, _ViewMetadata?: metadata_view.ViewMetadata,
73-
DebugContext: typeof debug_context.DebugContext, _DebugContext?: debug_context.DebugContext,
74+
ViewType: typeof view_type.ViewType,
75+
_ViewType: view_type.ViewType,
76+
ViewMetadata: typeof metadata_view.ViewMetadata,
77+
_ViewMetadata: metadata_view.ViewMetadata,
78+
DebugContext: typeof debug_context.DebugContext,
79+
_DebugContext: debug_context.DebugContext,
7480
StaticNodeDebugInfo: typeof debug_context.StaticNodeDebugInfo,
75-
_StaticNodeDebugInfo?: debug_context.StaticNodeDebugInfo,
81+
_StaticNodeDebugInfo: debug_context.StaticNodeDebugInfo,
7682
devModeEqual: typeof change_detection_util.devModeEqual,
7783
ValueUnwrapper: typeof change_detection_util.ValueUnwrapper,
78-
_ValueUnwrapper?: change_detection_util.ValueUnwrapper,
84+
_ValueUnwrapper: change_detection_util.ValueUnwrapper,
7985
RenderDebugInfo: typeof api.RenderDebugInfo,
80-
_RenderDebugInfo?: api.RenderDebugInfo,
81-
_DirectRenderer?: api.DirectRenderer,
82-
TemplateRef_: typeof template_ref.TemplateRef_, _TemplateRef_?: template_ref.TemplateRef_<any>,
86+
_RenderDebugInfo: api.RenderDebugInfo,
87+
_DirectRenderer: api.DirectRenderer,
88+
TemplateRef_: typeof template_ref.TemplateRef_,
89+
_TemplateRef_: template_ref.TemplateRef_<any>,
8390
ReflectionCapabilities: typeof reflection_capabilities.ReflectionCapabilities,
84-
_ReflectionCapabilities?: reflection_capabilities.ReflectionCapabilities,
91+
_ReflectionCapabilities: reflection_capabilities.ReflectionCapabilities,
8592
makeDecorator: typeof decorators.makeDecorator,
8693
DebugDomRootRenderer: typeof debug.DebugDomRootRenderer,
87-
_DebugDomRootRenderer?: debug.DebugDomRootRenderer,
88-
Console: typeof console.Console, _Console?: console.Console,
94+
_DebugDomRootRenderer: debug.DebugDomRootRenderer,
95+
Console: typeof console.Console,
96+
_Console: console.Console,
8997
reflector: typeof reflection.reflector,
90-
Reflector: typeof reflection.Reflector, _Reflector?: reflection.Reflector,
91-
NoOpAnimationPlayer: typeof NoOpAnimationPlayer_, _NoOpAnimationPlayer?: NoOpAnimationPlayer_,
92-
AnimationPlayer: typeof AnimationPlayer_, _AnimationPlayer?: AnimationPlayer_,
98+
Reflector: typeof reflection.Reflector,
99+
_Reflector: reflection.Reflector,
100+
NoOpAnimationPlayer: typeof NoOpAnimationPlayer_,
101+
_NoOpAnimationPlayer: NoOpAnimationPlayer_,
102+
AnimationPlayer: typeof AnimationPlayer_,
103+
_AnimationPlayer: AnimationPlayer_,
104+
105+
106+
93107
AnimationSequencePlayer: typeof AnimationSequencePlayer_,
94-
_AnimationSequencePlayer?: AnimationSequencePlayer_,
95-
AnimationGroupPlayer: typeof AnimationGroupPlayer_, _AnimationGroupPlayer?: AnimationGroupPlayer_,
96-
AnimationKeyframe: typeof AnimationKeyframe_, _AnimationKeyframe?: AnimationKeyframe_,
108+
_AnimationSequencePlayer: AnimationSequencePlayer_,
109+
AnimationGroupPlayer: typeof AnimationGroupPlayer_,
110+
_AnimationGroupPlayer: AnimationGroupPlayer_,
111+
AnimationKeyframe: typeof AnimationKeyframe_,
112+
_AnimationKeyframe: AnimationKeyframe_,
97113
prepareFinalAnimationStyles: typeof animationUtils.prepareFinalAnimationStyles,
98114
balanceAnimationKeyframes: typeof animationUtils.balanceAnimationKeyframes,
99115
flattenStyles: typeof animationUtils.flattenStyles,
100116
clearStyles: typeof animationUtils.clearStyles,
101117
renderStyles: typeof animationUtils.renderStyles,
102118
collectAndResolveStyles: typeof animationUtils.collectAndResolveStyles,
103119
APP_ID_RANDOM_PROVIDER: typeof application_tokens.APP_ID_RANDOM_PROVIDER,
104-
AnimationStyles: typeof AnimationStyles_, _AnimationStyles?: AnimationStyles_,
120+
AnimationStyles: typeof AnimationStyles_,
121+
_AnimationStyles: AnimationStyles_,
105122
ANY_STATE: typeof ANY_STATE_,
106123
DEFAULT_STATE: typeof DEFAULT_STATE_,
107124
EMPTY_STATE: typeof EMPTY_STATE_,
@@ -111,11 +128,8 @@ export const __core_private__: {
111128
AnimationTransition: typeof AnimationTransition
112129
view_utils: typeof view_utils,
113130
ERROR_COMPONENT_TYPE: typeof ERROR_COMPONENT_TYPE,
114-
<<<<<<< HEAD
115131
viewEngine: typeof viewEngine,
116-
=======
117132
TransitionEngine: typeof TransitionEngine
118-
>>>>>>> 4577b7c2a... refactor(animations): introduce @angular/animation module
119133
} = {
120134
isDefaultChangeDetectionStrategy: constants.isDefaultChangeDetectionStrategy,
121135
ChangeDetectorStatus: constants.ChangeDetectorStatus,
@@ -168,4 +182,4 @@ export const __core_private__: {
168182
AnimationTransition: AnimationTransition,
169183
ERROR_COMPONENT_TYPE: ERROR_COMPONENT_TYPE,
170184
TransitionEngine: TransitionEngine
171-
};
185+
} as any /* TODO(misko): export these using omega names instead */;

modules/@angular/core/src/util/decorators.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const Reflect = global.Reflect;
1717
*
1818
* @stable
1919
*/
20-
export interface ClassDefinition {
20+
export type ClassDefinition = {
2121
/**
2222
* Optional argument for specifying the superclass.
2323
*/
@@ -32,14 +32,15 @@ export interface ClassDefinition {
3232
*
3333
* See {@link Class} for example of usage.
3434
*/
35-
constructor: Function|any[];
36-
35+
constructor: Function | any[];
36+
} &
37+
{
3738
/**
3839
* Other methods on the class. Note that values should have type 'Function' but TS requires
3940
* all properties to have a narrower type than the index signature.
4041
*/
4142
[x: string]: Type<any>|Function|any[];
42-
}
43+
};
4344

4445
/**
4546
* An interface implemented by all Angular type decorators, which allows them to be used as ES7

modules/@angular/core/testing/private_export_testing.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,13 @@ import * as test_compiler from './test_compiler';
1111

1212
export const __core_private_testing__: {
1313
TestingCompiler: typeof test_compiler.TestingCompiler,
14-
_TestingCompiler?: test_compiler.TestingCompiler,
14+
_TestingCompiler: test_compiler.TestingCompiler,
1515
TestingCompilerFactory: typeof test_compiler.TestingCompilerFactory,
16-
_TestingCompilerFactory?: test_compiler.TestingCompilerFactory,
16+
_TestingCompilerFactory: test_compiler.TestingCompilerFactory,
1717
MockAnimationPlayer: typeof mock_animation_player.MockAnimationPlayer
18-
_MockAnimationPlayer?: mock_animation_player.MockAnimationPlayer
18+
_MockAnimationPlayer: mock_animation_player.MockAnimationPlayer
1919
} = {
2020
TestingCompiler: test_compiler.TestingCompiler,
2121
TestingCompilerFactory: test_compiler.TestingCompilerFactory,
2222
MockAnimationPlayer: mock_animation_player.MockAnimationPlayer
23-
};
23+
} as any /* TODO(misko): export these using omega names instead */;

modules/@angular/platform-browser/src/browser/meta.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,17 @@ import {DomAdapter} from '../dom/dom_adapter';
1414
*
1515
* @experimental
1616
*/
17-
export interface MetaDefinition {
18-
charset?: string;
19-
content?: string;
20-
httpEquiv?: string;
21-
id?: string;
22-
itemprop?: string;
17+
export type MetaDefinition = {
18+
charset?: string; content?: string; httpEquiv?: string; id?: string; itemprop?: string;
2319
name?: string;
2420
property?: string;
2521
scheme?: string;
2622
url?: string;
23+
} &
24+
{
25+
// TODO(IgorMinar): this type looks wrong
2726
[prop: string]: string;
28-
}
27+
};
2928

3029
/**
3130
* A service that can be used to get and add meta tags.

tools/public_api_guard/core/index.d.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,11 +211,12 @@ export declare abstract class ChangeDetectorRef {
211211
export declare function Class(clsDef: ClassDefinition): Type<any>;
212212

213213
/** @stable */
214-
export interface ClassDefinition {
215-
constructor: Function | any[];
214+
export declare type ClassDefinition = {
216215
extends?: Type<any>;
216+
constructor: Function | any[];
217+
} & {
217218
[x: string]: Type<any> | Function | any[];
218-
}
219+
};
219220

220221
/** @stable */
221222
export interface ClassProvider {

tools/public_api_guard/platform-browser/index.d.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ export declare class Meta {
7171
}
7272

7373
/** @experimental */
74-
export interface MetaDefinition {
74+
export declare type MetaDefinition = {
7575
charset?: string;
7676
content?: string;
7777
httpEquiv?: string;
@@ -81,8 +81,9 @@ export interface MetaDefinition {
8181
property?: string;
8282
scheme?: string;
8383
url?: string;
84+
} & {
8485
[prop: string]: string;
85-
}
86+
};
8687

8788
/** @deprecated */
8889
export declare class NgProbeToken {

0 commit comments

Comments
 (0)