X Tutup
Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -981,15 +981,16 @@ gulp.task('!pre.test.typings.layoutNodeModule', ['build.js.cjs'], function() {
.pipe(gulp.dest(path.join(tmpdir, 'node_modules')));
});
gulp.task('!pre.test.typings.copyTypingsSpec', function() {
return gulp.src(['typing_spec/*.ts'], {base: 'typing_spec'}).pipe(gulp.dest(path.join(tmpdir)));
return gulp.src(['typing_spec/*.ts'], {base: 'typing_spec'}).pipe(gulp.dest(tmpdir));
});

gulp.task('test.typings',
['!pre.test.typings.layoutNodeModule', '!pre.test.typings.copyTypingsSpec'], function() {
var tsc = require('gulp-typescript');

return gulp.src([tmpdir + '/**'])
return gulp.src([tmpdir + '/*.ts'])
.pipe(tsc({
target: 'ES5',
target: 'ES6',
module: 'commonjs',
experimentalDecorators: true,
noImplicitAny: true,
Expand Down
4 changes: 2 additions & 2 deletions modules/angular1_router/tsd.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"version": "v4",
"repo": "angular/DefinitelyTyped",
"repo": "DefinitelyTyped/DefinitelyTyped",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

no more forks!

"ref": "master",
"path": "typings",
"bundle": "typings/tsd.d.ts",
"installed": {
"angularjs/angular.d.ts": {
"commit": "746b9a892629060bc853e792afff536e0ec4655e"
"commit": "6eebd5e90a1cbd6b47b0705ba72dbcd5baf846f3"
}
}
}
36 changes: 0 additions & 36 deletions modules/angular2/manual_typings/globals-es6.d.ts

This file was deleted.

55 changes: 50 additions & 5 deletions modules/angular2/manual_typings/globals.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,52 @@
/**
* Declarations angular depends on for compilation to ES6.
* This file is also used to propagate our transitive typings
* to users.
* Subset of es6-shim typings.
* Angular should not require use of ES6 runtime but some API usages are already present.
* See https://github.com/angular/angular/issues/5242
* TODO(alexeagle): remove methods below which may not be present in targeted browser
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Not sure what you are trying to say with that TODO. We are targetting IE9 and it doesn't have any of those.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

so maybe the TODO is remove all of these - but I don't imagine we will really do that?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@mhevery FYI

*/
/// <reference path="../typings/es6-shim/es6-shim.d.ts"/>
/// <reference path="./globals-es6.d.ts"/>

declare type PromiseConstructor = typeof Promise;

interface String {
/**
* Returns true if the sequence of elements of searchString converted to a String is the
* same as the corresponding elements of this object (converted to a String) starting at
* position. Otherwise returns false.
*/
startsWith(searchString: string, position?: number): boolean;

/**
* Returns true if the sequence of elements of searchString converted to a String is the
* same as the corresponding elements of this object (converted to a String) starting at
* endPosition – length(this). Otherwise returns false.
*/
endsWith(searchString: string, endPosition?: number): boolean;
}
interface Array<T> {
/**
* Returns the value of the first element in the array where predicate is true, and undefined
* otherwise.
* @param predicate find calls predicate once for each element of the array, in ascending
* order, until it finds one where predicate returns true. If such an element is found, find
* immediately returns that element value. Otherwise, find returns undefined.
* @param thisArg If provided, it will be used as the this value for each invocation of
* predicate. If it is not provided, undefined is used instead.
*/
find(predicate: (value: T, index: number, obj: Array<T>) => boolean, thisArg?: any): T;
/**
* Returns the this object after filling the section identified by start and end with value
* @param value value to fill array section with
* @param start index to start filling the array at. If start is negative, it is treated as
* length+start where length is the length of the array.
* @param end index to stop filling the array at. If end is negative, it is treated as
* length+end.
*/
fill(value: T, start?: number, end?: number): T[];
}
interface NumberConstructor {
/**
* Returns true if the value passed is an integer, false otherwise.
* @param number A numeric value.
*/
isInteger(number: number): boolean;
}
8 changes: 0 additions & 8 deletions modules/angular2/src/core/change_detection/parser/lexer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -248,15 +248,12 @@ class _Scanner {
}

scanCharacter(start: number, code: number): Token {
assert(this.peek == code);
this.advance();
return newCharacterToken(start, code);
}


scanOperator(start: number, str: string): Token {
assert(this.peek == StringWrapper.charCodeAt(str, 0));
assert(SetWrapper.has(OPERATORS, str));
this.advance();
return newOperatorToken(start, str);
}
Expand All @@ -274,7 +271,6 @@ class _Scanner {
*/
scanComplexOperator(start: number, one: string, twoCode: number, two: string, threeCode?: number,
three?: string): Token {
assert(this.peek == StringWrapper.charCodeAt(one, 0));
this.advance();
var str: string = one;
if (this.peek == twoCode) {
Expand All @@ -285,12 +281,10 @@ class _Scanner {
this.advance();
str += three;
}
assert(SetWrapper.has(OPERATORS, str));
return newOperatorToken(start, str);
}

scanIdentifier(): Token {
assert(isIdentifierStart(this.peek));
var start: number = this.index;
this.advance();
while (isIdentifierPart(this.peek)) this.advance();
Expand All @@ -303,7 +297,6 @@ class _Scanner {
}

scanNumber(start: number): Token {
assert(isDigit(this.peek));
var simple: boolean = (this.index === start);
this.advance(); // Skip initial digit.
while (true) {
Expand All @@ -329,7 +322,6 @@ class _Scanner {
}

scanString(): Token {
assert(this.peek == $SQ || this.peek == $DQ);
var start: number = this.index;
var quote: number = this.peek;
this.advance(); // Skip initial quote.
Expand Down
9 changes: 5 additions & 4 deletions modules/angular2/src/core/zone/ng_zone.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import {ListWrapper, StringMapWrapper} from 'angular2/src/facade/collection';
import {normalizeBlank, isPresent, global} from 'angular2/src/facade/lang';
import {normalizeBlank, isPresent, global, ZoneLike} from 'angular2/src/facade/lang';
import {ObservableWrapper, EventEmitter} from 'angular2/src/facade/async';
import {wtfLeave, wtfCreateScope, WtfScopeFn} from '../profile/profile';

export interface NgZoneZone extends Zone {
export interface NgZoneZone extends ZoneLike {
/** @internal */
_innerZone: boolean;
}
Expand Down Expand Up @@ -348,8 +348,9 @@ export class NgZone {
var errorHandling;

if (enableLongStackTrace) {
errorHandling = StringMapWrapper.merge(
Zone.longStackTraceZone, {onError: function(e) { ngZone._notifyOnError(this, e); }});
errorHandling =
StringMapWrapper.merge(global.Zone.longStackTraceZone,
{onError: function(e) { ngZone._notifyOnError(this, e); }});
} else {
errorHandling = {onError: function(e) { ngZone._notifyOnError(this, e); }};
}
Expand Down
14 changes: 5 additions & 9 deletions modules/angular2/src/facade/async.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,16 @@ import {toPromise} from 'rxjs/operator/toPromise';
export {Observable} from 'rxjs/Observable';
export {Subject} from 'rxjs/Subject';

export namespace NodeJS {
export interface Timer {}
}

export class TimerWrapper {
static setTimeout(fn: (...args: any[]) => void, millis: number): NodeJS.Timer {
static setTimeout(fn: (...args: any[]) => void, millis: number): number {
return global.setTimeout(fn, millis);
}
static clearTimeout(id: NodeJS.Timer): void { global.clearTimeout(id); }
static clearTimeout(id: number): void { global.clearTimeout(id); }

static setInterval(fn: (...args: any[]) => void, millis: number): NodeJS.Timer {
static setInterval(fn: (...args: any[]) => void, millis: number): number {
return global.setInterval(fn, millis);
}
static clearInterval(id: NodeJS.Timer): void { global.clearInterval(id); }
static clearInterval(id: number): void { global.clearInterval(id); }
}

export class ObservableWrapper {
Expand Down Expand Up @@ -161,4 +157,4 @@ export class EventEmitter<T> extends Subject<T> {

return super.subscribe(schedulerFn, errorFn, completeFn);
}
}
}
37 changes: 35 additions & 2 deletions modules/angular2/src/facade/lang.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,36 @@
// Zones are TC-39 standards-track so users could choose a different implementation
// Rather than import {Zone} from 'zone.js' we define an interface
// so that any library that structurally matches may be used with Angular 2.
export interface ZoneLike {
fork(locals?: any): ZoneLike;
run(fn: any, applyTo?: any, applyWith?: any): any;
}
export interface ZoneLikeConstructor {
longStackTraceZone: { [key: string]: any; };
}

export interface BrowserNodeGlobal {
Object: typeof Object;
Array: typeof Array;
Map: typeof Map;
Set: typeof Set;
Date: DateConstructor;
RegExp: RegExpConstructor;
JSON: typeof JSON;
Math: any; // typeof Math;
assert(condition: any): void;
Reflect: any;
zone: ZoneLike;
Zone: ZoneLikeConstructor;
getAngularTestability: Function;
getAllAngularTestabilities: Function;
frameworkStabilizers: Array<Function>;
setTimeout: Function;
clearTimeout: Function;
setInterval: Function;
clearInterval: Function;
}

// TODO(jteplitz602): Load WorkerGlobalScope from lib.webworker.d.ts file #3492
declare var WorkerGlobalScope;
var globalScope: BrowserNodeGlobal;
Expand All @@ -10,7 +43,7 @@ if (typeof window === 'undefined') {
}
} else {
globalScope = <any>window;
};
}

export const IS_DART = false;

Expand Down Expand Up @@ -430,4 +463,4 @@ export function evalExpression(sourceUrl: string, expr: string, declarations: st

export function isPrimitive(obj: any): boolean {
return !isJsObject(obj);
}
}
2 changes: 1 addition & 1 deletion modules/angular2/src/testing/matchers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export interface NgMatchers extends jasmine.Matchers {
not: NgMatchers;
}

var _global: jasmine.GlobalPolluter = <any>(typeof window === 'undefined' ? global : window);
var _global = <any>(typeof window === 'undefined' ? global : window);

/**
* Jasmine matching function with Angular matchers mixed in.
Expand Down
2 changes: 1 addition & 1 deletion modules/angular2/src/testing/testing.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export {inject, injectAsync} from './test_injector';

export {expect, NgMatchers} from './matchers';

var _global: jasmine.GlobalPolluter = <any>(typeof window === 'undefined' ? global : window);
var _global = <any>(typeof window === 'undefined' ? global : window);

/**
* Run a function (with an optional asynchronous callback) after each test case.
Expand Down
2 changes: 1 addition & 1 deletion modules/angular2/src/testing/testing_internal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ export {expect, NgMatchers} from './matchers';

export var proxy: ClassDecorator = (t) => t;

var _global: jasmine.GlobalPolluter = <any>(typeof window === 'undefined' ? global : window);
var _global = <any>(typeof window === 'undefined' ? global : window);

export var afterEach: Function = _global.afterEach;

Expand Down
23 changes: 13 additions & 10 deletions modules/angular2/tsd.json
Original file line number Diff line number Diff line change
@@ -1,30 +1,33 @@
{
"version": "v4",
"repo": "angular/DefinitelyTyped",
"repo": "DefinitelyTyped/DefinitelyTyped",
"ref": "master",
"path": "typings",
"bundle": "typings/tsd.d.ts",
"installed": {
"es6-shim/es6-shim.d.ts": {
"commit": "4b36b94d5910aa8a4d20bdcd5bd1f9ae6ad18d3c"
"es6-promise/es6-promise.d.ts": {
"commit": "6eebd5e90a1cbd6b47b0705ba72dbcd5baf846f3"
},
"es6-collections/es6-collections.d.ts": {
"commit": "6eebd5e90a1cbd6b47b0705ba72dbcd5baf846f3"
},
"hammerjs/hammerjs.d.ts": {
"commit": "22c44d95912a07f81c103a694330b15b92f7cb40"
"commit": "6eebd5e90a1cbd6b47b0705ba72dbcd5baf846f3"
},
"jasmine/jasmine.d.ts": {
"commit": "4b36b94d5910aa8a4d20bdcd5bd1f9ae6ad18d3c"
"commit": "6eebd5e90a1cbd6b47b0705ba72dbcd5baf846f3"
},
"node/node.d.ts": {
"commit": "51738fdf1643d269067861b405e87503b7479236"
"commit": "6eebd5e90a1cbd6b47b0705ba72dbcd5baf846f3"
},
"selenium-webdriver/selenium-webdriver.d.ts": {
"commit": "be0b6b394f77a59e192ad7cfec18078706e44db5"
"commit": "6eebd5e90a1cbd6b47b0705ba72dbcd5baf846f3"
},
"zone/zone.d.ts": {
"commit": "31e7317c9a0793857109236ef7c7f223305a8aa9"
"zone.js/zone.js.d.ts": {
"commit": "6eebd5e90a1cbd6b47b0705ba72dbcd5baf846f3"
},
"angular-protractor/angular-protractor.d.ts": {
"commit": "4207593c012565a7ea800ed861ffbe5011e7a501"
"commit": "6eebd5e90a1cbd6b47b0705ba72dbcd5baf846f3"
}
}
}
3 changes: 2 additions & 1 deletion modules/playground/e2e_test/material/progress_linear_spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ describe('md-progress-linear', function() {
var incrementButton = element(by.id('increment'));
var decrementButton = element(by.id('decrement'));

var initialValue = progressBar.getAttribute('aria-valuenow');
// Really a Promise<string> but can be coerced to a number after resolving
var initialValue: any = progressBar.getAttribute('aria-valuenow');

incrementButton.click();
expect(progressBar.getAttribute('aria-valuenow')).toBeGreaterThan(initialValue);
Expand Down
6 changes: 3 additions & 3 deletions npm-shrinkwrap.clean.json
Original file line number Diff line number Diff line change
Expand Up @@ -5345,7 +5345,7 @@
}
},
"ts2dart": {
"version": "0.7.19",
"version": "0.7.22",
"dependencies": {
"source-map": {
"version": "0.4.4"
Expand Down Expand Up @@ -5824,9 +5824,9 @@
}
},
"zone.js": {
"version": "0.5.11"
"version": "0.5.13"
}
},
"name": "angular-srcs",
"version": "2.0.0-beta.1"
"version": "2.0.0-beta.2"
}
Loading
X Tutup