-
Notifications
You must be signed in to change notification settings - Fork 29.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5 from DefinitelyTyped/master
Pull latest changes from head
- Loading branch information
Showing
212 changed files
with
37,530 additions
and
17,932 deletions.
There are no files selected for viewing
39 changes: 39 additions & 0 deletions
39
angular-ui-router-default/angular-ui-router-default-tests.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/// <reference path="./angular-ui-router-default.d.ts" /> | ||
|
||
angular.module("test", [ | ||
"ui.router", | ||
"ui.router.default" | ||
]) | ||
.config(function($stateProvider: angular.ui.IStateProvider) { | ||
$stateProvider | ||
.state('concrete', { | ||
// no abstract or default | ||
}) | ||
.state('string', { | ||
abstract: true, | ||
default: 'concrete' | ||
}) | ||
.state('func_str', { | ||
abstract: true, | ||
default: function($rootScope): string { return $rootScope.test; } | ||
}) | ||
.state('func_promise', { | ||
abstract: true, | ||
default: function($q: ng.IQService): ng.IPromise<string> { | ||
return $q.when("concrete"); | ||
} | ||
}) | ||
.state('injection_str', { | ||
abstract: true, | ||
default: ["$rootScope", function($rootScope) { | ||
return $rootScope.test; | ||
}] | ||
}) | ||
.state('injection_promise', { | ||
abstract: true, | ||
default: ["$q", function($q: ng.IQService) { | ||
return $q.when("concrete"); | ||
}] | ||
}) | ||
; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Type definitions for angular-ui-router-default 0.5+ | ||
// Project: https://github.com/nonplus/angular-ui-router-default | ||
// Definitions by: Stepan Riha <https://github.com/nonplus> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
|
||
/// <reference path="../angular-ui-router/angular-ui-router.d.ts" /> | ||
|
||
declare namespace angular.ui { | ||
export type StateDefaultSpecifier = string | ||
| ((...args: any[]) => string) | ||
| ((...args: any[]) => ng.IPromise<string>) | ||
| (string | ((...args: any[]) => string))[] | ||
| (string | ((...args: any[]) => ng.IPromise<string>))[]; | ||
interface IState { | ||
default?: StateDefaultSpecifier | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
angular-ui-router-uib-modal/angular-ui-router-uib-modal-tests.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/// <reference path="./angular-ui-router-uib-modal.d.ts" /> | ||
|
||
angular.module("test", [ | ||
"ui.bootstrap", | ||
"ui.router", | ||
"ui.router.default" | ||
]) | ||
.config(function($stateProvider: angular.ui.IStateProvider) { | ||
$stateProvider | ||
.state('contacts', { | ||
// no modal | ||
resolve: { | ||
a: function() { | ||
return "a"; | ||
}, | ||
b: function() { | ||
return ["a", "b"]; | ||
} | ||
} | ||
}) | ||
.state('contacts.contact', { | ||
// boolean modal | ||
modal: true | ||
}) | ||
.state('contacts.contact.edit', { | ||
// string[] modal | ||
modal: ["a", "b"] | ||
}) | ||
; | ||
}); |
12 changes: 12 additions & 0 deletions
12
angular-ui-router-uib-modal/angular-ui-router-uib-modal.d.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
// Type definitions for angular-ui-uib-modal 0.11+ (ui.router module) | ||
// Project: https://github.com/nonplus/angular-ui-router-uib-modal | ||
// Definitions by: Stepan Riha <https://github.com/nonplus> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
|
||
/// <reference path="../angular-ui-router/angular-ui-router.d.ts" /> | ||
|
||
declare namespace angular.ui { | ||
interface IState { | ||
modal?: boolean | string[]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/// <reference path="async-polling.d.ts" /> | ||
|
||
import * as AsyncPolling from "async-polling"; | ||
|
||
// Tests based on examples in https://github.com/cGuille/async-polling#readme | ||
|
||
AsyncPolling(end => { | ||
end(); | ||
}, 3000).run(); | ||
|
||
function someAsynchroneProcess(callback: (error?: Error, response?: any) => any): any { | ||
callback(); | ||
} | ||
|
||
let polling = AsyncPolling(end => { | ||
someAsynchroneProcess(function (error, response) { | ||
if (error) { | ||
end(error); | ||
return; | ||
} | ||
|
||
end(null, response); | ||
}); | ||
}, 3000); | ||
polling.on("error", (error: Error) => {}); | ||
polling.on("result", (result: any) => {}); | ||
polling.run(); | ||
polling.stop(); | ||
|
||
AsyncPolling(function(end) { | ||
this.stop(); | ||
end(); | ||
}, 3000).run(); | ||
|
||
let i = 0; | ||
|
||
polling = AsyncPolling(function(end) { | ||
++i; | ||
if (i === 3) { | ||
return end(new Error("i is " + i)); | ||
} | ||
if (i >= 5) { | ||
this.stop(); | ||
return end(null, `#${i} stop`); | ||
} | ||
end(null, `#${i} wait a second...`); | ||
}, 1000); | ||
|
||
const eventNames: AsyncPolling.EventName[] = ["run", "start", "end", "schedule", "stop"]; | ||
eventNames.forEach(eventName => { | ||
polling.on(eventName, () => { | ||
console.log("lifecycle:", eventName); | ||
}); | ||
}); | ||
|
||
polling.on("result", (result: any) => { | ||
console.log("result:", result); | ||
}); | ||
|
||
polling.on("error", (error: Error) => { | ||
console.error("error:", error); | ||
}); | ||
|
||
polling.run(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
// Type definitions for AsyncPolling | ||
// Project: https://github.com/cGuille/async-polling | ||
// Definitions by: Zlatko Andonovski <https://github.com/Goldsmith42/> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
|
||
declare module "async-polling" { | ||
module AsyncPolling { | ||
export type EventName = "run"|"start"|"error"|"result"|"end"|"schedule"|"stop"; | ||
} | ||
|
||
function AsyncPolling<Result>(pollingFunc: (end: (err?: Error, result?: Result) => any) => any, delay: number): { | ||
run: () => any; | ||
stop: () => any; | ||
on: (eventName: AsyncPolling.EventName, listener: Function) => any; | ||
} | ||
|
||
export = AsyncPolling; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
/// <reference path="./bases.d.ts" /> | ||
import * as bases from 'bases'; | ||
|
||
let bs16String: string = bases.toBase(200, 16); // => 'c8' | ||
let bs62String: string = bases.toBase(99999, 62); // => 'q0T' | ||
let customBaseString: string = bases.toAlphabet(300, 'aAbBcC'); // => 'Abba' | ||
|
||
let frombs16Int: number = bases.fromBase('c8', 16); // => 200 | ||
let frombs62Int: number = bases.fromBase('q0T', 62); // => 99999 | ||
let customBaseInt: number = bases.fromAlphabet('Abba', 'aAbBcC'); // => 300 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// Type definitions for bases 0.2.1 | ||
// Project: https://github.com/aseemk/bases.js | ||
// Definitions by: Hari Krishna <https://github.com/harikv> | ||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped | ||
|
||
declare module "bases" { | ||
export function toAlphabet(num: number, alphabet: string): string; | ||
|
||
export function fromAlphabet(str: string, alphabet: string): number; | ||
|
||
export function toBase(num: number, base: number): string; | ||
|
||
export function fromBase(str: string, base:number): number; | ||
|
||
export let KNOWN_ALPHABETS: any; | ||
|
||
export let NUMERALS: string; | ||
|
||
export let LETTERS_LOWERCASE: string; | ||
|
||
export let LETTERS_UPPERCASE: string; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
/// <reference path="bonjour.d.ts" /> | ||
import * as bonjour from 'bonjour'; | ||
|
||
var bonjourOptions: bonjour.BonjourOptions; | ||
var bonjourInstance: bonjour.Bonjour; | ||
|
||
var serviceOptions: bonjour.ServiceOptions; | ||
var service: bonjour.Service; | ||
|
||
var browserOptions: bonjour.BrowserOptions; | ||
var browser: bonjour.Browser; | ||
|
||
bonjourOptions = { interface: '192.168.1.1', port: 5353 }; | ||
bonjourInstance = new bonjour.Bonjour(bonjourOptions); | ||
|
||
serviceOptions = { name: 'My Web Server', type: 'http', port: 3000 }; | ||
service = bonjourInstance.publish(serviceOptions); | ||
|
||
browserOptions = { protocol: 'tcp', type: 'http' }; | ||
browser = bonjour.find(browserOptions); | ||
|
Oops, something went wrong.