build: allow users to specify --strictNullChecks (#14382)

PR Close #14382
This commit is contained in:
Alex Eagle 2017-02-08 19:50:16 -08:00 committed by Miško Hevery
parent 96073e51c3
commit 03e855ae8f
8 changed files with 72 additions and 54 deletions

View File

@ -7,6 +7,7 @@
"compilerOptions": {
"module": "es2015",
"moduleResolution": "node",
"strictNullChecks": true,
"target": "es6",
"noImplicitAny": false,
"sourceMap": false,

View File

@ -8,7 +8,8 @@
"rootDir": ".",
"target": "es5",
"lib": ["es5", "dom", "es2015.collection", "es2015.iterable", "es2015.promise"],
"types": []
"types": [],
"strictNullChecks": true
},
"files": [
"include-all.ts",

View File

@ -48,52 +48,68 @@ import * as viewEngine from './view/index';
export const __core_private__: {
isDefaultChangeDetectionStrategy: typeof constants.isDefaultChangeDetectionStrategy,
ChangeDetectorStatus: typeof constants.ChangeDetectorStatus,
_ChangeDetectorStatus?: constants.ChangeDetectorStatus,
_ChangeDetectorStatus: constants.ChangeDetectorStatus,
constructDependencies: typeof reflective_provider.constructDependencies,
LifecycleHooks: typeof lifecycle_hooks.LifecycleHooks,
_LifecycleHooks?: lifecycle_hooks.LifecycleHooks,
_LifecycleHooks: lifecycle_hooks.LifecycleHooks,
LIFECYCLE_HOOKS_VALUES: typeof lifecycle_hooks.LIFECYCLE_HOOKS_VALUES,
ReflectorReader: typeof reflector_reader.ReflectorReader,
_ReflectorReader?: reflector_reader.ReflectorReader,
_SetterFn?: reflection_types.SetterFn;
_GetterFn?: reflection_types.GetterFn;
_MethodFn?: reflection_types.MethodFn;
_ReflectorReader: reflector_reader.ReflectorReader,
_SetterFn: reflection_types.SetterFn;
_GetterFn: reflection_types.GetterFn;
_MethodFn: reflection_types.MethodFn;
CodegenComponentFactoryResolver:
typeof component_factory_resolver.CodegenComponentFactoryResolver,
ComponentRef_: typeof component_factory.ComponentRef_,
_CodegenComponentFactoryResolver?: component_factory_resolver.CodegenComponentFactoryResolver,
ViewContainer: typeof view_container.ViewContainer, _ViewContainer?: view_container.ViewContainer,
AppView: typeof view.AppView, _AppView?: view.AppView<any>,
DebugAppView: typeof view.DebugAppView, _DebugAppView?: view.DebugAppView<any>,
_CodegenComponentFactoryResolver: component_factory_resolver.CodegenComponentFactoryResolver,
ViewContainer: typeof view_container.ViewContainer,
_ViewContainer: view_container.ViewContainer,
AppView: typeof view.AppView,
_AppView: view.AppView<any>,
DebugAppView: typeof view.DebugAppView,
_DebugAppView: view.DebugAppView<any>,
NgModuleInjector: typeof ng_module_factory.NgModuleInjector,
_NgModuleInjector?: ng_module_factory.NgModuleInjector<any>,
_NgModuleInjector: ng_module_factory.NgModuleInjector<any>,
registerModuleFactory: typeof ng_module_factory_loader.registerModuleFactory,
ViewType: typeof view_type.ViewType, _ViewType?: view_type.ViewType,
ViewMetadata: typeof metadata_view.ViewMetadata, _ViewMetadata?: metadata_view.ViewMetadata,
DebugContext: typeof debug_context.DebugContext, _DebugContext?: debug_context.DebugContext,
ViewType: typeof view_type.ViewType,
_ViewType: view_type.ViewType,
ViewMetadata: typeof metadata_view.ViewMetadata,
_ViewMetadata: metadata_view.ViewMetadata,
DebugContext: typeof debug_context.DebugContext,
_DebugContext: debug_context.DebugContext,
StaticNodeDebugInfo: typeof debug_context.StaticNodeDebugInfo,
_StaticNodeDebugInfo?: debug_context.StaticNodeDebugInfo,
_StaticNodeDebugInfo: debug_context.StaticNodeDebugInfo,
devModeEqual: typeof change_detection_util.devModeEqual,
ValueUnwrapper: typeof change_detection_util.ValueUnwrapper,
_ValueUnwrapper?: change_detection_util.ValueUnwrapper,
_ValueUnwrapper: change_detection_util.ValueUnwrapper,
RenderDebugInfo: typeof api.RenderDebugInfo,
_RenderDebugInfo?: api.RenderDebugInfo,
_DirectRenderer?: api.DirectRenderer,
TemplateRef_: typeof template_ref.TemplateRef_, _TemplateRef_?: template_ref.TemplateRef_<any>,
_RenderDebugInfo: api.RenderDebugInfo,
_DirectRenderer: api.DirectRenderer,
TemplateRef_: typeof template_ref.TemplateRef_,
_TemplateRef_: template_ref.TemplateRef_<any>,
ReflectionCapabilities: typeof reflection_capabilities.ReflectionCapabilities,
_ReflectionCapabilities?: reflection_capabilities.ReflectionCapabilities,
_ReflectionCapabilities: reflection_capabilities.ReflectionCapabilities,
makeDecorator: typeof decorators.makeDecorator,
DebugDomRootRenderer: typeof debug.DebugDomRootRenderer,
_DebugDomRootRenderer?: debug.DebugDomRootRenderer,
Console: typeof console.Console, _Console?: console.Console,
_DebugDomRootRenderer: debug.DebugDomRootRenderer,
Console: typeof console.Console,
_Console: console.Console,
reflector: typeof reflection.reflector,
Reflector: typeof reflection.Reflector, _Reflector?: reflection.Reflector,
NoOpAnimationPlayer: typeof NoOpAnimationPlayer_, _NoOpAnimationPlayer?: NoOpAnimationPlayer_,
AnimationPlayer: typeof AnimationPlayer_, _AnimationPlayer?: AnimationPlayer_,
Reflector: typeof reflection.Reflector,
_Reflector: reflection.Reflector,
NoOpAnimationPlayer: typeof NoOpAnimationPlayer_,
_NoOpAnimationPlayer: NoOpAnimationPlayer_,
AnimationPlayer: typeof AnimationPlayer_,
_AnimationPlayer: AnimationPlayer_,
AnimationSequencePlayer: typeof AnimationSequencePlayer_,
_AnimationSequencePlayer?: AnimationSequencePlayer_,
AnimationGroupPlayer: typeof AnimationGroupPlayer_, _AnimationGroupPlayer?: AnimationGroupPlayer_,
AnimationKeyframe: typeof AnimationKeyframe_, _AnimationKeyframe?: AnimationKeyframe_,
_AnimationSequencePlayer: AnimationSequencePlayer_,
AnimationGroupPlayer: typeof AnimationGroupPlayer_,
_AnimationGroupPlayer: AnimationGroupPlayer_,
AnimationKeyframe: typeof AnimationKeyframe_,
_AnimationKeyframe: AnimationKeyframe_,
prepareFinalAnimationStyles: typeof animationUtils.prepareFinalAnimationStyles,
balanceAnimationKeyframes: typeof animationUtils.balanceAnimationKeyframes,
flattenStyles: typeof animationUtils.flattenStyles,
@ -101,7 +117,8 @@ export const __core_private__: {
renderStyles: typeof animationUtils.renderStyles,
collectAndResolveStyles: typeof animationUtils.collectAndResolveStyles,
APP_ID_RANDOM_PROVIDER: typeof application_tokens.APP_ID_RANDOM_PROVIDER,
AnimationStyles: typeof AnimationStyles_, _AnimationStyles?: AnimationStyles_,
AnimationStyles: typeof AnimationStyles_,
_AnimationStyles: AnimationStyles_,
ANY_STATE: typeof ANY_STATE_,
DEFAULT_STATE: typeof DEFAULT_STATE_,
EMPTY_STATE: typeof EMPTY_STATE_,
@ -111,11 +128,8 @@ export const __core_private__: {
AnimationTransition: typeof AnimationTransition
view_utils: typeof view_utils,
ERROR_COMPONENT_TYPE: typeof ERROR_COMPONENT_TYPE,
<<<<<<< HEAD
viewEngine: typeof viewEngine,
=======
TransitionEngine: typeof TransitionEngine
>>>>>>> 4577b7c2a... refactor(animations): introduce @angular/animation module
} = {
isDefaultChangeDetectionStrategy: constants.isDefaultChangeDetectionStrategy,
ChangeDetectorStatus: constants.ChangeDetectorStatus,
@ -168,4 +182,4 @@ export const __core_private__: {
AnimationTransition: AnimationTransition,
ERROR_COMPONENT_TYPE: ERROR_COMPONENT_TYPE,
TransitionEngine: TransitionEngine
};
} as any /* TODO(misko): export these using omega names instead */;

View File

@ -17,7 +17,7 @@ const Reflect = global.Reflect;
*
* @stable
*/
export interface ClassDefinition {
export type ClassDefinition = {
/**
* Optional argument for specifying the superclass.
*/
@ -32,14 +32,15 @@ export interface ClassDefinition {
*
* See {@link Class} for example of usage.
*/
constructor: Function|any[];
constructor: Function | any[];
} &
{
/**
* Other methods on the class. Note that values should have type 'Function' but TS requires
* all properties to have a narrower type than the index signature.
*/
[x: string]: Type<any>|Function|any[];
}
};
/**
* An interface implemented by all Angular type decorators, which allows them to be used as ES7

View File

@ -11,13 +11,13 @@ import * as test_compiler from './test_compiler';
export const __core_private_testing__: {
TestingCompiler: typeof test_compiler.TestingCompiler,
_TestingCompiler?: test_compiler.TestingCompiler,
_TestingCompiler: test_compiler.TestingCompiler,
TestingCompilerFactory: typeof test_compiler.TestingCompilerFactory,
_TestingCompilerFactory?: test_compiler.TestingCompilerFactory,
_TestingCompilerFactory: test_compiler.TestingCompilerFactory,
MockAnimationPlayer: typeof mock_animation_player.MockAnimationPlayer
_MockAnimationPlayer?: mock_animation_player.MockAnimationPlayer
_MockAnimationPlayer: mock_animation_player.MockAnimationPlayer
} = {
TestingCompiler: test_compiler.TestingCompiler,
TestingCompilerFactory: test_compiler.TestingCompilerFactory,
MockAnimationPlayer: mock_animation_player.MockAnimationPlayer
};
} as any /* TODO(misko): export these using omega names instead */;

View File

@ -14,18 +14,17 @@ import {DomAdapter} from '../dom/dom_adapter';
*
* @experimental
*/
export interface MetaDefinition {
charset?: string;
content?: string;
httpEquiv?: string;
id?: string;
itemprop?: string;
export type MetaDefinition = {
charset?: string; content?: string; httpEquiv?: string; id?: string; itemprop?: string;
name?: string;
property?: string;
scheme?: string;
url?: string;
} &
{
// TODO(IgorMinar): this type looks wrong
[prop: string]: string;
}
};
/**
* A service that can be used to get and add meta tags.

View File

@ -211,11 +211,12 @@ export declare abstract class ChangeDetectorRef {
export declare function Class(clsDef: ClassDefinition): Type<any>;
/** @stable */
export interface ClassDefinition {
constructor: Function | any[];
export declare type ClassDefinition = {
extends?: Type<any>;
constructor: Function | any[];
} & {
[x: string]: Type<any> | Function | any[];
}
};
/** @stable */
export interface ClassProvider {

View File

@ -71,7 +71,7 @@ export declare class Meta {
}
/** @experimental */
export interface MetaDefinition {
export declare type MetaDefinition = {
charset?: string;
content?: string;
httpEquiv?: string;
@ -81,8 +81,9 @@ export interface MetaDefinition {
property?: string;
scheme?: string;
url?: string;
} & {
[prop: string]: string;
}
};
/** @deprecated */
export declare class NgProbeToken {