Produce .d.ts files from our typescript compilation.
Deliver them into our npm module output so users can consume them directly. Fixes #3082
This commit is contained in:
31
modules/angular2/manual_typings/globals-es6.d.ts
vendored
Normal file
31
modules/angular2/manual_typings/globals-es6.d.ts
vendored
Normal file
@ -0,0 +1,31 @@
|
||||
/**
|
||||
* Declarations angular depends on for compilation to ES6.
|
||||
* This file is also used to propagate our transitive typings
|
||||
* to users.
|
||||
*/
|
||||
|
||||
/// <reference path="../typings/zone/zone.d.ts"/>
|
||||
/// <reference path="../typings/hammerjs/hammerjs.d.ts"/>
|
||||
/// <reference path="../typings/jasmine/jasmine.d.ts"/>
|
||||
/// <reference path="../typings/angular-protractor/angular-protractor.d.ts"/>
|
||||
declare var assert: any;
|
||||
|
||||
interface BrowserNodeGlobal {
|
||||
Object: typeof Object;
|
||||
Array: typeof Array;
|
||||
Map: typeof Map;
|
||||
Set: typeof Set;
|
||||
Date: typeof Date;
|
||||
RegExp: typeof RegExp;
|
||||
JSON: typeof JSON;
|
||||
Math: typeof Math;
|
||||
assert(condition: any): void;
|
||||
Reflect: any;
|
||||
zone: Zone;
|
||||
getAngularTestability: Function;
|
||||
getAllAngularTestabilities: Function;
|
||||
setTimeout: Function;
|
||||
clearTimeout: Function;
|
||||
setInterval: Function;
|
||||
clearInterval: Function;
|
||||
}
|
29
modules/angular2/manual_typings/globals.d.ts
vendored
29
modules/angular2/manual_typings/globals.d.ts
vendored
@ -1,26 +1,7 @@
|
||||
/**
|
||||
* This file contains declarations of global symbols we reference in our code
|
||||
* Declarations angular depends on for compilation to ES6.
|
||||
* This file is also used to propagate our transitive typings
|
||||
* to users.
|
||||
*/
|
||||
|
||||
/// <reference path="../typings/zone/zone.d.ts"/>
|
||||
declare var assert: any;
|
||||
|
||||
interface BrowserNodeGlobal {
|
||||
Object: typeof Object;
|
||||
Array: typeof Array;
|
||||
Map: typeof Map;
|
||||
Set: typeof Set;
|
||||
Date: typeof Date;
|
||||
RegExp: typeof RegExp;
|
||||
JSON: typeof JSON;
|
||||
Math: typeof Math;
|
||||
assert(condition): void;
|
||||
Reflect: any;
|
||||
zone: Zone;
|
||||
getAngularTestability: Function;
|
||||
getAllAngularTestabilities: Function;
|
||||
setTimeout: Function;
|
||||
clearTimeout: Function;
|
||||
setInterval: Function;
|
||||
clearInterval: Function;
|
||||
}
|
||||
/// <reference path="../typings/es6-shim/es6-shim.d.ts"/>
|
||||
/// <reference path="./globals-es6.d.ts"/>
|
||||
|
@ -13,6 +13,7 @@
|
||||
"zone.js": "<%= packageJson.dependencies['zone.js'] %>"
|
||||
},
|
||||
"devDependencies": <%= JSON.stringify(packageJson.defaultDevDependencies) %>,
|
||||
"typings": "./angular2.d.ts",
|
||||
"typescript": {
|
||||
"definitions": [
|
||||
"bundles/typings/angular2/angular2.d.ts",
|
||||
|
@ -117,9 +117,6 @@ export function createNgZone(): NgZone {
|
||||
|
||||
var _platform: PlatformRef;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export function platformCommon(bindings?: Array<Type | Binding | any[]>, initializer?: () => void):
|
||||
PlatformRef {
|
||||
if (isPresent(_platform)) {
|
||||
|
@ -2,9 +2,6 @@ import {isPresent} from 'angular2/src/core/facade/lang';
|
||||
import {BaseException} from 'angular2/src/core/facade/exceptions';
|
||||
import {ListWrapper, MapWrapper} from 'angular2/src/core/facade/collection';
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export class Locals {
|
||||
constructor(public parent: Locals, public current: Map<any, any>) {}
|
||||
|
||||
|
@ -30,9 +30,6 @@ import {
|
||||
} from './exceptions';
|
||||
import {resolveForwardRef} from './forward_ref';
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export class Dependency {
|
||||
constructor(public key: Key, public optional: boolean, public lowerBoundVisibility: any,
|
||||
public upperBoundVisibility: any, public properties: any[]) {}
|
||||
@ -280,7 +277,6 @@ export class ResolvedBinding_ implements ResolvedBinding {
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* An internal resolved representation of a factory function created by resolving {@link Binding}.
|
||||
*/
|
||||
export class ResolvedFactory {
|
||||
|
@ -387,7 +387,6 @@ export class BindingWithVisibility {
|
||||
}
|
||||
|
||||
/**
|
||||
* @internal
|
||||
* Used to provide dependencies that cannot be easily expressed as bindings.
|
||||
*/
|
||||
export interface DependencyProvider {
|
||||
|
@ -1,5 +1,4 @@
|
||||
/**
|
||||
* @internal
|
||||
* Type literals is a Dart-only feature. This is here only so we can x-compile
|
||||
* to multiple languages.
|
||||
*/
|
||||
|
@ -2,3 +2,4 @@
|
||||
|
||||
// I need to be here to make TypeScript think this is a module.
|
||||
import {} from 'angular2/src/core/facade/lang';
|
||||
export var workaround_empty_observable_list_diff: any;
|
||||
|
@ -1,4 +1,3 @@
|
||||
///<reference path="../../../typings/tsd.d.ts" />
|
||||
import {global, isPresent} from 'angular2/src/core/facade/lang';
|
||||
// TODO(jeffbcross): use ES6 import once typings are available
|
||||
var Subject = require('@reactivex/rxjs/dist/cjs/Subject');
|
||||
@ -56,14 +55,18 @@ export class PromiseWrapper {
|
||||
}
|
||||
}
|
||||
|
||||
export class TimerWrapper {
|
||||
static setTimeout(fn: Function, millis: number): number { return global.setTimeout(fn, millis); }
|
||||
static clearTimeout(id: number): void { global.clearTimeout(id); }
|
||||
export namespace NodeJS {
|
||||
export interface Timer {}
|
||||
}
|
||||
|
||||
static setInterval(fn: Function, millis: number): number {
|
||||
export class TimerWrapper {
|
||||
static setTimeout(fn: (...args: any[]) => void, millis: number): NodeJS.Timer { return global.setTimeout(fn, millis); }
|
||||
static clearTimeout(id: NodeJS.Timer): void { global.clearTimeout(id); }
|
||||
|
||||
static setInterval(fn: (...args: any[]) => void, millis: number): NodeJS.Timer {
|
||||
return global.setInterval(fn, millis);
|
||||
}
|
||||
static clearInterval(id: number): void { global.clearInterval(id); }
|
||||
static clearInterval(id: NodeJS.Timer): void { global.clearInterval(id); }
|
||||
}
|
||||
|
||||
export class ObservableWrapper {
|
||||
|
@ -259,7 +259,7 @@ export class ListWrapper {
|
||||
static toString<T>(l: T[]): string { return l.toString(); }
|
||||
static toJSON<T>(l: T[]): string { return JSON.stringify(l); }
|
||||
|
||||
static maximum<T>(list: T[], predicate: (T) => number): T {
|
||||
static maximum<T>(list: T[], predicate: (t: T) => number): T {
|
||||
if (list.length == 0) {
|
||||
return null;
|
||||
}
|
||||
|
@ -1,5 +1,3 @@
|
||||
/// <reference path="../../../manual_typings/globals.d.ts" />
|
||||
|
||||
import {ExceptionHandler} from './exception_handler';
|
||||
|
||||
export {ExceptionHandler} from './exception_handler';
|
||||
|
@ -1,5 +1,3 @@
|
||||
/// <reference path="../../../manual_typings/globals.d.ts" />
|
||||
|
||||
// TODO(jteplitz602): Load WorkerGlobalScope from lib.webworker.d.ts file #3492
|
||||
declare var WorkerGlobalScope;
|
||||
var globalScope: BrowserNodeGlobal;
|
||||
@ -196,7 +194,7 @@ export class StringJoiner {
|
||||
export class NumberParseError extends Error {
|
||||
name: string;
|
||||
|
||||
constructor(public message: string) { super(message); }
|
||||
constructor(public message: string) { super(); }
|
||||
|
||||
toString(): string { return this.message; }
|
||||
}
|
||||
@ -251,7 +249,7 @@ export class RegExpWrapper {
|
||||
flags = flags.replace(/g/g, '');
|
||||
return new _global.RegExp(regExpStr, flags + 'g');
|
||||
}
|
||||
static firstMatch(regExp: RegExp, input: string): string[] {
|
||||
static firstMatch(regExp: RegExp, input: string): RegExpExecArray {
|
||||
// Reset multimatch regex state
|
||||
regExp.lastIndex = 0;
|
||||
return regExp.exec(input);
|
||||
@ -277,7 +275,7 @@ export class RegExpMatcherWrapper {
|
||||
static next(matcher: {
|
||||
re: RegExp;
|
||||
input: string
|
||||
}): string[] {
|
||||
}): RegExpExecArray {
|
||||
return matcher.re.exec(matcher.input);
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,6 @@
|
||||
import {MapWrapper} from 'angular2/src/core/facade/collection';
|
||||
import {SimpleChange} from 'angular2/src/core/change_detection/change_detection_util';
|
||||
|
||||
/**
|
||||
* @internal
|
||||
*/
|
||||
export enum LifecycleHooks {
|
||||
OnInit,
|
||||
OnDestroy,
|
||||
|
@ -13,13 +13,13 @@ interface Trace {
|
||||
endTimeRange(range: Range);
|
||||
}
|
||||
|
||||
interface Range {}
|
||||
export interface Range {}
|
||||
|
||||
interface Events {
|
||||
createScope(signature: string, flags: any): Scope;
|
||||
}
|
||||
|
||||
interface Scope {
|
||||
export interface Scope {
|
||||
(...args): any;
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ import {
|
||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
||||
import {GetterFn, SetterFn, MethodFn} from './types';
|
||||
import {PlatformReflectionCapabilities} from 'platform_reflection_capabilities';
|
||||
import {PlatformReflectionCapabilities} from './platform_reflection_capabilities';
|
||||
|
||||
export class ReflectionCapabilities implements PlatformReflectionCapabilities {
|
||||
private _reflect: any;
|
||||
|
@ -1,5 +1,3 @@
|
||||
/// <reference path="../../../../../typings/hammerjs/hammerjs.d.ts"/>
|
||||
|
||||
import {HammerGesturesPluginCommon} from './hammer_common';
|
||||
import {isPresent} from 'angular2/src/core/facade/lang';
|
||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||
|
@ -90,7 +90,7 @@ export class KeyEventsPlugin extends EventManagerPlugin {
|
||||
return fullKey;
|
||||
}
|
||||
|
||||
static eventCallback(element: HTMLElement, fullKey: any, handler: (Event) => any, zone: NgZone):
|
||||
static eventCallback(element: HTMLElement, fullKey: any, handler: (e: Event) => any, zone: NgZone):
|
||||
(event: KeyboardEvent) => void {
|
||||
return (event) => {
|
||||
if (StringWrapper.equals(KeyEventsPlugin.getEventFullKey(event), fullKey)) {
|
||||
|
@ -236,7 +236,7 @@ if (!(Reflect && Reflect.getMetadata)) {
|
||||
throw 'reflect-metadata shim is required when using class decorators';
|
||||
}
|
||||
|
||||
export function makeDecorator(annotationCls, chainFn: (fn: Function) => void = null): (...args) =>
|
||||
export function makeDecorator(annotationCls, chainFn: (fn: Function) => void = null): (...args: any[]) =>
|
||||
(cls: any) => any {
|
||||
function DecoratorFactory(objOrType): (cls: any) => any {
|
||||
var annotationInstance = new (<any>annotationCls)(objOrType);
|
||||
|
@ -1,7 +1,3 @@
|
||||
/// <reference path="../../typings/node/node.d.ts" />
|
||||
/// <reference path="../../typings/angular-protractor/angular-protractor.d.ts" />
|
||||
/// <reference path="../../typings/jasmine/jasmine"/>
|
||||
|
||||
import * as webdriver from 'selenium-webdriver';
|
||||
|
||||
export var browser: protractor.IBrowser = global['browser'];
|
||||
|
@ -1,5 +1,3 @@
|
||||
/// <reference path="../../typings/jasmine/jasmine.d.ts"/>
|
||||
|
||||
import {global} from 'angular2/src/core/facade/lang';
|
||||
import {BaseException, WrappedException} from 'angular2/src/core/facade/exceptions';
|
||||
import {ListWrapper} from 'angular2/src/core/facade/collection';
|
||||
|
@ -1,5 +1,3 @@
|
||||
/// <reference path="../../typings/jasmine/jasmine.d.ts"/>
|
||||
|
||||
import {DOM} from 'angular2/src/core/dom/dom_adapter';
|
||||
import {StringMapWrapper} from 'angular2/src/core/facade/collection';
|
||||
import {global, isFunction, Math} from 'angular2/src/core/facade/lang';
|
||||
|
@ -1,4 +1,3 @@
|
||||
/// <reference path="../../../manual_typings/globals.d.ts" />
|
||||
import {MessageBus} from "angular2/src/web_workers/shared/message_bus";
|
||||
import {print, isPresent, DateWrapper, stringify} from "angular2/src/core/facade/lang";
|
||||
import {
|
||||
|
@ -23,7 +23,7 @@ var needsLongerTimers = browserDetection.isSlow || browserDetection.isEdge;
|
||||
var resultTimer = 1000;
|
||||
var testTimeout = browserDetection.isEdge ? 1200 : 100;
|
||||
// Schedules a macrotask (using a timer)
|
||||
function macroTask(fn: Function, timer = 1): void {
|
||||
function macroTask(fn: (...args: any[]) => void, timer = 1): void {
|
||||
// adds longer timers for passing tests in IE and Edge
|
||||
_zone.runOutsideAngular(() => TimerWrapper.setTimeout(fn, needsLongerTimers ? timer : 1));
|
||||
}
|
||||
|
@ -39,7 +39,7 @@ export class ImageDemo {
|
||||
}
|
||||
}
|
||||
|
||||
private _filter(i: number): Function {
|
||||
private _filter(i: number): (...args: any[]) => void {
|
||||
return () => {
|
||||
var imageData = this._bitmapService.convertToImageData(this.images[i].buffer);
|
||||
imageData = this._bitmapService.applySepia(imageData);
|
||||
|
Reference in New Issue
Block a user