Skip to content

Commit 9040a2c

Browse files
committed
fix(manual_typings/globals): remove Type alias from globals and add it to every module which relies on it
Closes #170
1 parent 6fb4dfe commit 9040a2c

35 files changed

+82
-55
lines changed

manual_typings/globals.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,7 @@ import * as angular from 'angular';
55
///////////////////////////////////////////////////////////////////////////////
66
declare global {
77
type StringMap = {[key: string]: string};
8-
type Type = Function;
9-
type ProvideSpreadType = string|Type;
8+
type ProvideSpreadType = string|Function;
109
}
1110

1211
///////////////////////////////////////////////////////////////////////////////

src/common/directives/core_directives.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Type } from '../../facade/lang';
1+
import { Type } from '../../facade/type';
22
import { NgForm } from './ng_form'
33
import { NgModel } from './ng_model'
44
import { NgSelect } from './ng_select'
@@ -43,7 +43,7 @@ import { NgSelect } from './ng_select'
4343
* }
4444
* ```
4545
*/
46-
export const CORE_DIRECTIVES: Type[] = [
46+
export const CORE_DIRECTIVES: Function[] = [
4747
NgForm,
4848
NgModel,
4949
NgSelect

src/core/di/forward_ref.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1-
import { Type, stringify, isFunction } from '../../facade/lang';
1+
import { stringify, isFunction } from '../../facade/lang';
2+
import { Type } from '../../facade/type';
3+
24

35
/**
46
* An interface that a function passed into {@link forwardRef} has to implement.
@@ -9,7 +11,7 @@ import { Type, stringify, isFunction } from '../../facade/lang';
911
*/
1012
export interface ForwardRefFn {
1113
(): any;
12-
__forward_ref__?: Type,
14+
__forward_ref__?: Function,
1315
toString?():string
1416
}
1517

@@ -27,7 +29,7 @@ export interface ForwardRefFn {
2729
export function forwardRef(forwardRefFn: ForwardRefFn): Type {
2830
forwardRefFn.__forward_ref__ = forwardRef;
2931
forwardRefFn.toString = function() { return stringify(this()); };
30-
return forwardRefFn as Type;
32+
return forwardRefFn as any as Type;
3133
}
3234

3335
/**

src/core/di/key.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {OpaqueToken} from './opaque_token';
88
import {ListWrapper} from '../../facade/collections';
99
import {isType} from '../../facade/lang';
1010
import {getTypeName} from '../../facade/lang';
11+
import { Type } from '../../facade/type';
1112

1213
/**
1314
* @TODO

src/core/di/provider.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {
2-
Type,
32
isString,
43
isBlank,
54
isType,
@@ -10,6 +9,7 @@ import {
109
normalizeBool,
1110
isArray
1211
} from '../../facade/lang';
12+
import { Type } from '../../facade/type';
1313
import { reflector } from '../reflection/reflection';
1414
import { OpaqueToken } from './opaque_token';
1515
import {
@@ -31,7 +31,7 @@ import { isInjectMetadata } from './provider_util';
3131

3232
export type PropMetaInst = InputMetadata | OutputMetadata | HostBindingMetadata | HostListenerMetadata;
3333
export type ParamMetaInst = HostMetadata | InjectMetadata | SelfMetadata | SkipSelfMetadata;
34-
export type ProviderType = Type | string | OpaqueToken;
34+
export type ProviderType = Type | OpaqueToken | Function | string ;
3535
export type ProviderAliasOptions = {useClass?: Type,useValue?: any,useFactory?: Function, deps?: Object[]};
3636

3737
export class Provider {
@@ -219,7 +219,7 @@ class ProviderBuilder{
219219
static createFromType(
220220
type: ProviderType,
221221
{ useClass, useValue, useFactory, deps }: ProviderAliasOptions
222-
): [string,Type] {
222+
): [string,Type|Function] {
223223

224224
// ...provide('myFactory',{useFactory: () => () => { return new Foo(); } })
225225
if ( isPresent( useFactory ) ) {
@@ -322,7 +322,7 @@ class ProviderBuilder{
322322
export function provide(
323323
type: ProviderType,
324324
{ useClass, useValue, useFactory, deps }: ProviderAliasOptions = {}
325-
): [string,Type] {
325+
): [string,Type|Function] {
326326
return ProviderBuilder.createFromType( type, { useClass, useValue, useFactory, deps } );
327327
}
328328

src/core/di/provider_util.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { isString, isPresent } from '../../facade/lang';
2+
import { Type } from '../../facade/type';
23
import { DirectiveMetadata, ComponentMetadata, NgModuleMetadata } from '../directives/metadata_directives';
34
import { PipeMetadata } from '../pipes/metadata';
45

src/core/di/reflective_provider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { isType, isArray, isString, getFuncName, isBlank, isPresent } from '../../facade/lang';
2+
import { Type } from '../../facade/type';
23

34
import { reflector } from '../reflection/reflection';
45

@@ -50,7 +51,7 @@ export function resolveReflectiveProvider( provider: Provider ): {method: string
5051
* @returns {any}
5152
* @private
5253
*/
53-
export function _getAngular1ModuleMetadataByType( injectable: Type ): { providerName: string, providerMethod: string, moduleMethod: string} {
54+
export function _getAngular1ModuleMetadataByType( injectable: Type|Function ): { providerName: string, providerMethod: string, moduleMethod: string} {
5455
// only the first class annotations is injectable
5556
const [annotation] = reflector.annotations( injectable );
5657

src/core/directives/controller/controller_factory.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import { StringMapWrapper } from '../../../facade/collections';
2+
import { Type } from '../../../facade/type';
23
import { EventEmitter } from '../../../facade/async';
34
import { DirectiveMetadata, ComponentMetadata } from '../metadata_directives';
45
import { ChangeDetectorRef } from '../../change_detection/change_detector_ref';

src/core/directives/decorators.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { makeDecorator, makePropDecorator, TypeDecorator } from '../util/decorators';
2-
import { Type } from '../../facade/lang';
2+
import { Type } from '../../facade/type';
33
import { ContentChildrenMetadata, ContentChildMetadata, ViewChildrenMetadata, ViewChildMetadata } from './metadata_di';
44
import {
55
ComponentMetadata,

src/core/directives/directive_provider.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { DirectiveResolver } from '../linker/directive_resolver';
22
import { assign, isFunction, noop, resolveDirectiveNameFromSelector, stringify, isJsObject } from '../../facade/lang';
33
import { StringMapWrapper } from '../../facade/collections';
4+
import { Type } from '../../facade/type';
45
import { resolveImplementedLifeCycleHooks, ImplementedLifeCycleHooks } from '../linker/directive_lifecycles_reflector';
56
import { ChildrenChangeHook } from '../linker/directive_lifecycle_interfaces';
67
import { DirectiveMetadata, ComponentMetadata, LegacyDirectiveDefinition } from './metadata_directives';

0 commit comments

Comments
 (0)