feat(typings): add typing specs

add test in gulpfile which will compile a basic TS file with generated
angular2.d.ts to ensure generated d.ts is valid syntactic TS

Adds support for enums in .d.ts generation pipeline.
Removes renaming reexports in http module.
This commit is contained in:
Daria Jung
2015-06-16 10:46:12 -07:00
committed by Rado Kirov
parent 6149ce28a7
commit 24646e7eb8
13 changed files with 102 additions and 19 deletions

View File

@ -11,14 +11,16 @@ export * from './angular2';
// 1) if the symbol is intended to be part of the public API, then re-export somewhere else
// 2) if the symbol should be omitted from the public API, then the class exposing it should
// not be exported, or should avoid exposing the symbol.
export {AbstractChangeDetector} from './src/change_detection/abstract_change_detector';
export {ProtoRecord} from './src/change_detection/proto_record';
export {ProtoRecord, RecordType} from './src/change_detection/proto_record';
export * from './src/core/compiler/element_injector';
export {DependencyAnnotation} from './src/di/annotations_impl';
// FIXME: this is a workaround for https://github.com/angular/angular/issues/2356
// We export the Directive *annotation* instead of the *decorator*.
// But it breaks the build.
export {Directive, LifecycleEvent} from './src/core/annotations_impl/annotations';
export {Form} from './src/forms/directives/form_interface';
export {TypeDecorator, ClassDefinition} from './src/util/decorators';
export {Query} from './src/core/annotations_impl/di';
export {ControlContainer} from './src/forms/directives/control_container';
export {Injectable} from './src/di/annotations_impl';
export {BaseQueryList} from './src/core/compiler/base_query_list';

View File

@ -17,7 +17,16 @@ export {
JitChangeDetection,
PreGeneratedChangeDetection,
preGeneratedProtoDetectors,
defaultPipeRegistry
defaultPipeRegistry,
DirectiveIndex,
BindingRecord,
ProtoChangeDetector,
ChangeDispatcher,
ChangeDetector,
Locals,
ChangeDetectorDefinition,
BasePipe,
DirectiveRecord
} from './change_detection';
export {
@ -40,7 +49,10 @@ export {
InstantiationError,
InvalidBindingError,
NoAnnotationError,
OpaqueToken
OpaqueToken,
ResolvedBinding,
BindingBuilder,
Dependency
} from './di';
export * from './core';

View File

@ -45,7 +45,7 @@ export {DynamicChangeDetector} from './src/change_detection/dynamic_change_detec
export {ChangeDetectorRef} from './src/change_detection/change_detector_ref';
export {PipeRegistry} from './src/change_detection/pipes/pipe_registry';
export {uninitialized} from './src/change_detection/change_detection_util';
export {WrappedValue, Pipe, PipeFactory} from './src/change_detection/pipes/pipe';
export {WrappedValue, Pipe, PipeFactory, BasePipe} from './src/change_detection/pipes/pipe';
export {NullPipe, NullPipeFactory} from './src/change_detection/pipes/null_pipe';
export {
defaultPipes,

View File

@ -16,9 +16,19 @@ export {Request} from 'angular2/src/http/static_request';
export {Response} from 'angular2/src/http/static_response';
export {Http, XHRBackend, XHRConnection, BaseRequestOptions, RequestOptions, HttpFactory};
export {IHttp} from 'angular2/src/http/interfaces';
export {
IHttp,
IRequestOptions,
IRequest,
IResponse,
Connection,
ConnectionBackend
} from 'angular2/src/http/interfaces';
export {Headers} from 'angular2/src/http/headers';
export * from 'angular2/src/http/enums';
export {URLSearchParams} from 'angular2/src/http/url_search_params';
/**
* Provides a basic set of injectables to use the {@link Http} service in any application.
*

View File

@ -20,7 +20,7 @@ export interface IRequestOptions {
cache?: RequestCacheOpts;
}
export interface Request {
export interface IRequest {
method: RequestMethods;
mode: RequestModesOpts;
credentials: RequestCredentialsOpts;
@ -34,7 +34,7 @@ export interface ResponseOptions {
url?: string;
}
export interface Response {
export interface IResponse {
headers: Headers;
ok: boolean;
status: number;
@ -49,12 +49,14 @@ export interface Response {
json(): Object;
}
export interface ConnectionBackend { createConnection(observer: any, config: Request): Connection; }
export interface ConnectionBackend {
createConnection(observer: any, config: IRequest): Connection;
}
export interface Connection {
readyState: ReadyStates;
request: Request;
response: Rx.Subject<Response>;
request: IRequest;
response: Rx.Subject<IResponse>;
dispose(): void;
}
@ -81,4 +83,4 @@ export interface Connection {
*/
// Prefixed as IHttp because used in conjunction with Http class, but interface is callable
// constructor(@Inject(Http) http:IHttp)
export interface IHttp { (url: string, options?: IRequestOptions): Rx.Observable<Response> }
export interface IHttp { (url: string, options?: IRequestOptions): Rx.Observable<IResponse> }

View File

@ -1,6 +1,6 @@
import {RequestMethods, RequestModesOpts, RequestCredentialsOpts} from './enums';
import {URLSearchParams} from './url_search_params';
import {IRequestOptions, Request as IRequest} from './interfaces';
import {IRequestOptions, IRequest} from './interfaces';
import {Headers} from './headers';
import {BaseException, RegExpWrapper} from 'angular2/src/facade/lang';

View File

@ -1,4 +1,4 @@
import {Response as IResponse, ResponseOptions} from './interfaces';
import {IResponse, ResponseOptions} from './interfaces';
import {ResponseTypes} from './enums';
import {baseResponseOptions} from './base_response_options';
import {BaseException, isJsObject, isString, global} from 'angular2/src/facade/lang';