From 2910d805588fea2ac15d93697b0192019bca673d Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Wed, 21 May 2014 14:25:08 -0700 Subject: [PATCH 1/5] Don't use tscparams files that are just '""' --- _infrastructure/tests/src/tsc.ts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/_infrastructure/tests/src/tsc.ts b/_infrastructure/tests/src/tsc.ts index 9730a1394..61c833528 100644 --- a/_infrastructure/tests/src/tsc.ts +++ b/_infrastructure/tests/src/tsc.ts @@ -10,9 +10,9 @@ module DT { var Promise: typeof Promise = require('bluebird'); export interface TscExecOptions { - tscVersion?:string; - useTscParams?:boolean; - checkNoImplicitAny?:boolean; + tscVersion?: string; + useTscParams?: boolean; + checkNoImplicitAny?: boolean; } export class Tsc { @@ -30,18 +30,24 @@ module DT { return fileExists(tsfile); }).then((exists) => { if (!exists) { - throw new Error(tsfile + ' not exists'); + throw new Error(tsfile + ' does not exist'); } tscPath = './_infrastructure/tests/typescript/' + options.tscVersion + '/tsc.js'; return fileExists(tscPath); }).then((exists) => { if (!exists) { - throw new Error(tscPath + ' is not exists'); + throw new Error(tscPath + ' does not exist'); } return fileExists(tsfile + '.tscparams'); - }).then((exists) => { + }).then(exists => { + if (exists) { + return readFile(tsfile + '.tscparams'); + } else { + return new Promise(''); + } + }).then((paramContents: string) => { var command = 'node ' + tscPath + ' --module commonjs '; - if (options.useTscParams && exists) { + if (options.useTscParams && paramContents.trim() !== '' && paramContents.trim() !== '""') { command += '@' + tsfile + '.tscparams'; } else if (options.checkNoImplicitAny) { From 98cd5ba7768a5f7000c11af7daf66ec8ef9d6ac7 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Wed, 21 May 2014 14:25:16 -0700 Subject: [PATCH 2/5] Add readFile promise wrapper --- _infrastructure/tests/src/util.ts | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/_infrastructure/tests/src/util.ts b/_infrastructure/tests/src/util.ts index a712bb90c..a77583eda 100644 --- a/_infrastructure/tests/src/util.ts +++ b/_infrastructure/tests/src/util.ts @@ -37,4 +37,16 @@ module DT { }); }); } + + export function readFile(target: string): Promise { + return new Promise((resolve, reject) => { + fs.readFile(target, 'utf-8', (err, contents: string) => { + if (err) { + reject(err); + } else { + resolve(contents); + } + }); + }); + } } From 8959bcdc718fac43ca417e5fb24c9130af707f90 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Wed, 21 May 2014 14:25:49 -0700 Subject: [PATCH 3/5] Manually specify generic type parameter so return expression types match --- angularjs/angular-tests.ts | 2 +- angularjs/legacy/angular-1.0-tests.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/angularjs/angular-tests.ts b/angularjs/angular-tests.ts index 8ab1efc72..4acd18eeb 100644 --- a/angularjs/angular-tests.ts +++ b/angularjs/angular-tests.ts @@ -64,7 +64,7 @@ angular.module('http-auth-interceptor', []) function error(response: ng.IHttpPromiseCallbackArg) { if (response.status === 401) { - var deferred = $q.defer(); + var deferred = $q.defer(); authServiceProvider.pushToBuffer(response.config, deferred); $rootScope.$broadcast('event:auth-loginRequired'); return deferred.promise; diff --git a/angularjs/legacy/angular-1.0-tests.ts b/angularjs/legacy/angular-1.0-tests.ts index ff3c87f77..dc4dbcee0 100644 --- a/angularjs/legacy/angular-1.0-tests.ts +++ b/angularjs/legacy/angular-1.0-tests.ts @@ -64,7 +64,7 @@ angular.module('http-auth-interceptor', []) function error(response: ng.IHttpPromiseCallbackArg) { if (response.status === 401) { - var deferred = $q.defer(); + var deferred = $q.defer(); authServiceProvider.pushToBuffer(response.config, deferred); $rootScope.$broadcast('event:auth-loginRequired'); return deferred.promise; From fe51e671f500453bee42b0a78211ffda7d1be149 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Wed, 21 May 2014 14:26:06 -0700 Subject: [PATCH 4/5] Remove nested-comment reference tag that was confusing a simple parser --- fabricjs/fabricjs.d.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/fabricjs/fabricjs.d.ts b/fabricjs/fabricjs.d.ts index 80087caa6..813782047 100644 --- a/fabricjs/fabricjs.d.ts +++ b/fabricjs/fabricjs.d.ts @@ -3,10 +3,6 @@ // Definitions by: Oliver Klemencic // DefinitelyTyped: https://github.com/borisyankov/DefinitelyTyped -/* -USAGE -/// -*/ declare module fabric { function createCanvasForNode(width: number, height: number): ICanvas; From 72b92f2e376d1af3deaa33b63e88822377531b11 Mon Sep 17 00:00:00 2001 From: Ryan Cavanaugh Date: Wed, 21 May 2014 14:26:23 -0700 Subject: [PATCH 5/5] Unify tabs/spaces --- angularjs/angular.d.ts | 70 +++++++++++++++++++++--------------------- 1 file changed, 35 insertions(+), 35 deletions(-) diff --git a/angularjs/angular.d.ts b/angularjs/angular.d.ts index 728c71fd3..f4cc59a04 100755 --- a/angularjs/angular.d.ts +++ b/angularjs/angular.d.ts @@ -52,9 +52,9 @@ declare module ng { isUndefined(value: any): boolean; lowercase(str: string): string; /** construct your angular application - official docs: Interface for configuring angular modules. - see: http://docs.angularjs.org/api/angular.Module - */ + official docs: Interface for configuring angular modules. + see: http://docs.angularjs.org/api/angular.Module + */ module( /** name of your module you want to create */ name: string, @@ -82,12 +82,12 @@ declare module ng { animation(name: string, inlineAnnotatedFunction: any[]): IModule; animation(object: Object): IModule; /** configure existing services. - Use this method to register work which needs to be performed on module loading - */ + Use this method to register work which needs to be performed on module loading + */ config(configFn: Function): IModule; /** configure existing services. - Use this method to register work which needs to be performed on module loading - */ + Use this method to register work which needs to be performed on module loading + */ config(inlineAnnotatedFunction: any[]): IModule; constant(name: string, value: any): IModule; constant(object: Object): IModule; @@ -125,10 +125,10 @@ declare module ng { // see http://docs.angularjs.org/api/ng.$compile.directive.Attributes /////////////////////////////////////////////////////////////////////////// interface IAttributes { - // this is necessary to be able to access the scoped attributes. it's not very elegant - // because you have to use attrs['foo'] instead of attrs.foo but I don't know of a better way - // this should really be limited to return string but it creates this problem: http://stackoverflow.com/q/17201854/165656 - [name: string]: any; + // this is necessary to be able to access the scoped attributes. it's not very elegant + // because you have to use attrs['foo'] instead of attrs.foo but I don't know of a better way + // this should really be limited to return string but it creates this problem: http://stackoverflow.com/q/17201854/165656 + [name: string]: any; // Adds the CSS class value specified by the classVal parameter to the // element. If animations are enabled then an animation will be triggered @@ -385,11 +385,11 @@ declare module ng { } interface IParseProvider { - logPromiseWarnings(): boolean; - logPromiseWarnings(value: boolean): IParseProvider; + logPromiseWarnings(): boolean; + logPromiseWarnings(value: boolean): IParseProvider; - unwrapPromises(): boolean; - unwrapPromises(value: boolean): IParseProvider; + unwrapPromises(): boolean; + unwrapPromises(value: boolean): IParseProvider; } interface ICompiledExpression { @@ -702,26 +702,26 @@ declare module ng { // SCEService // see http://docs.angularjs.org/api/ng.$sce /////////////////////////////////////////////////////////////////////////// - interface ISCEService { - getTrusted(type: string, mayBeTrusted: any): any; - getTrustedCss(value: any): any; - getTrustedHtml(value: any): any; - getTrustedJs(value: any): any; - getTrustedResourceUrl(value: any): any; - getTrustedUrl(value: any): any; - parse(type: string, expression: string): (context: any, locals: any) => any; - parseAsCss(expression: string): (context: any, locals: any) => any; - parseAsHtml(expression: string): (context: any, locals: any) => any; - parseAsJs(expression: string): (context: any, locals: any) => any; - parseAsResourceUrl(expression: string): (context: any, locals: any) => any; - parseAsUrl(expression: string): (context: any, locals: any) => any; - trustAs(type: string, value: any): any; - trustAsHtml(value: any): any; - trustAsJs(value: any): any; - trustAsResourceUrl(value: any): any; - trustAsUrl(value: any): any; - isEnabled(): boolean; - } + interface ISCEService { + getTrusted(type: string, mayBeTrusted: any): any; + getTrustedCss(value: any): any; + getTrustedHtml(value: any): any; + getTrustedJs(value: any): any; + getTrustedResourceUrl(value: any): any; + getTrustedUrl(value: any): any; + parse(type: string, expression: string): (context: any, locals: any) => any; + parseAsCss(expression: string): (context: any, locals: any) => any; + parseAsHtml(expression: string): (context: any, locals: any) => any; + parseAsJs(expression: string): (context: any, locals: any) => any; + parseAsResourceUrl(expression: string): (context: any, locals: any) => any; + parseAsUrl(expression: string): (context: any, locals: any) => any; + trustAs(type: string, value: any): any; + trustAsHtml(value: any): any; + trustAsJs(value: any): any; + trustAsResourceUrl(value: any): any; + trustAsUrl(value: any): any; + isEnabled(): boolean; + } /////////////////////////////////////////////////////////////////////////// // SCEProvider