diff --git a/integration/hello_world__closure/tsconfig.json b/integration/hello_world__closure/tsconfig.json index 4251dbfcec..25ba5a8fc7 100644 --- a/integration/hello_world__closure/tsconfig.json +++ b/integration/hello_world__closure/tsconfig.json @@ -7,6 +7,7 @@ "compilerOptions": { "module": "es2015", "moduleResolution": "node", + "strictNullChecks": true, "target": "es6", "noImplicitAny": false, "sourceMap": false, diff --git a/integration/typings_test_ts21/tsconfig.json b/integration/typings_test_ts21/tsconfig.json index 171acb2444..468b20cdac 100644 --- a/integration/typings_test_ts21/tsconfig.json +++ b/integration/typings_test_ts21/tsconfig.json @@ -8,7 +8,8 @@ "rootDir": ".", "target": "es5", "lib": ["es5", "dom", "es2015.collection", "es2015.iterable", "es2015.promise"], - "types": [] + "types": [], + "strictNullChecks": true }, "files": [ "include-all.ts", diff --git a/modules/@angular/core/src/core_private_export.ts b/modules/@angular/core/src/core_private_export.ts index ef43f462f7..cfef55fcc3 100644 --- a/modules/@angular/core/src/core_private_export.ts +++ b/modules/@angular/core/src/core_private_export.ts @@ -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, - DebugAppView: typeof view.DebugAppView, _DebugAppView?: view.DebugAppView, + _CodegenComponentFactoryResolver: component_factory_resolver.CodegenComponentFactoryResolver, + ViewContainer: typeof view_container.ViewContainer, + _ViewContainer: view_container.ViewContainer, + AppView: typeof view.AppView, + _AppView: view.AppView, + DebugAppView: typeof view.DebugAppView, + _DebugAppView: view.DebugAppView, NgModuleInjector: typeof ng_module_factory.NgModuleInjector, - _NgModuleInjector?: ng_module_factory.NgModuleInjector, + _NgModuleInjector: ng_module_factory.NgModuleInjector, 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_, + _RenderDebugInfo: api.RenderDebugInfo, + _DirectRenderer: api.DirectRenderer, + TemplateRef_: typeof template_ref.TemplateRef_, + _TemplateRef_: template_ref.TemplateRef_, 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 */; diff --git a/modules/@angular/core/src/util/decorators.ts b/modules/@angular/core/src/util/decorators.ts index 1909055229..c8a36102fb 100644 --- a/modules/@angular/core/src/util/decorators.ts +++ b/modules/@angular/core/src/util/decorators.ts @@ -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|Function|any[]; -} +}; /** * An interface implemented by all Angular type decorators, which allows them to be used as ES7 diff --git a/modules/@angular/core/testing/private_export_testing.ts b/modules/@angular/core/testing/private_export_testing.ts index 6bf5efa2d3..5723c671c3 100644 --- a/modules/@angular/core/testing/private_export_testing.ts +++ b/modules/@angular/core/testing/private_export_testing.ts @@ -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 */; diff --git a/modules/@angular/platform-browser/src/browser/meta.ts b/modules/@angular/platform-browser/src/browser/meta.ts index 30b9d6a15d..b9ee0770f2 100644 --- a/modules/@angular/platform-browser/src/browser/meta.ts +++ b/modules/@angular/platform-browser/src/browser/meta.ts @@ -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. diff --git a/tools/public_api_guard/core/index.d.ts b/tools/public_api_guard/core/index.d.ts index 92395c1e03..60c0a75a0f 100644 --- a/tools/public_api_guard/core/index.d.ts +++ b/tools/public_api_guard/core/index.d.ts @@ -211,11 +211,12 @@ export declare abstract class ChangeDetectorRef { export declare function Class(clsDef: ClassDefinition): Type; /** @stable */ -export interface ClassDefinition { - constructor: Function | any[]; +export declare type ClassDefinition = { extends?: Type; + constructor: Function | any[]; +} & { [x: string]: Type | Function | any[]; -} +}; /** @stable */ export interface ClassProvider { diff --git a/tools/public_api_guard/platform-browser/index.d.ts b/tools/public_api_guard/platform-browser/index.d.ts index 4e3b75ef6a..4fb87b358f 100644 --- a/tools/public_api_guard/platform-browser/index.d.ts +++ b/tools/public_api_guard/platform-browser/index.d.ts @@ -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 {