Skip to content

Commit

Permalink
build: allow users to specify --strictNullChecks (#14382)
Browse files Browse the repository at this point in the history
PR Close #14382
  • Loading branch information
alexeagle authored and mhevery committed Feb 10, 2017
1 parent 96073e5 commit 03e855a
Show file tree
Hide file tree
Showing 8 changed files with 72 additions and 54 deletions.
1 change: 1 addition & 0 deletions integration/hello_world__closure/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"compilerOptions": {
"module": "es2015",
"moduleResolution": "node",
"strictNullChecks": true,
"target": "es6",
"noImplicitAny": false,
"sourceMap": false,
Expand Down
3 changes: 2 additions & 1 deletion integration/typings_test_ts21/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"rootDir": ".",
"target": "es5",
"lib": ["es5", "dom", "es2015.collection", "es2015.iterable", "es2015.promise"],
"types": []
"types": [],
"strictNullChecks": true
},
"files": [
"include-all.ts",
Expand Down
80 changes: 47 additions & 33 deletions modules/@angular/core/src/core_private_export.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,60 +48,77 @@ 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,
clearStyles: typeof animationUtils.clearStyles,
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_,
Expand All @@ -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,
Expand Down Expand Up @@ -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 */;
9 changes: 5 additions & 4 deletions modules/@angular/core/src/util/decorators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const Reflect = global.Reflect;
*
* @stable
*/
export interface ClassDefinition {
export type ClassDefinition = {
/**
* Optional argument for specifying the superclass.
*/
Expand All @@ -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
Expand Down
8 changes: 4 additions & 4 deletions modules/@angular/core/testing/private_export_testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 */;
13 changes: 6 additions & 7 deletions modules/@angular/platform-browser/src/browser/meta.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 4 additions & 3 deletions tools/public_api_guard/core/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
5 changes: 3 additions & 2 deletions tools/public_api_guard/platform-browser/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ export declare class Meta {
}

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

/** @deprecated */
export declare class NgProbeToken {
Expand Down

1 comment on commit 03e855a

@IgorMinar
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should have been "feat" not "build" - @alexeagle please pick the commit type primarily based on the user-facing impact.

Please sign in to comment.