Merge pull request #12224 from DefinitelyTyped/zhengbli_merge

Merge with master 10/25
This commit is contained in:
Zhengbo Li
2016-10-25 17:00:40 -07:00
committed by GitHub
299 changed files with 108767 additions and 9715 deletions
+199 -14
View File
@@ -4,36 +4,221 @@
> The repository for *high quality* TypeScript type definitions.
For more information see the [definitelytyped.org](http://definitelytyped.org) website.
Also see the [definitelytyped.org](http://definitelytyped.org) website, although information in this README is more up-to-date.
## Usage
Include a line like this:
## What are declaration files?
```typescript
/// <reference path="jquery.d.ts" />
See the [TypeScript handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html).
## How do I get them?
### npm
This is the preferred method. This is only available for TypeScript 2.0+ users. For example:
```sh
npm install --save-dev @types/node
```
## Contributions
The types should then be automatically included by the compiler.
See more in the [handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/consumption.html).
For an NPM package "foo", typings for it will be at "@types/foo".
If you can't find your package, look for it on [TypeSearch](https://microsoft.github.io/TypeSearch/).
If you still can't find it, check if it [bundles](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) its own typings.
This is usually provided in a `"types"` or `"typings"` field in the `package.json`,
or just look for any ".d.ts" files in the package and manually include them with a `/// <reference path="" />`.
### Other methods
These can be used by TypeScript 1.0.
* [Typings](https://github.com/typings/typings)
* [NuGet](http://nuget.org/Tpackages?q=DefinitelyTyped)
* Manually download from the `master` branch of this repository
You may need to add manual [references](http://www.typescriptlang.org/docs/handbook/triple-slash-directives.html).
## How can I contribute?
DefinitelyTyped only works because of contributions by users like you!
Please see the [contribution guide](http://definitelytyped.org/guides/contributing.html) on how to contribute to DefinitelyTyped.
### Test
## How to get the definitions
Before you share your improvement with the world, use it yourself.
* Directly from the GitHub repos
* [NuGet packages](http://nuget.org/packages?q=DefinitelyTyped)
* [Typings - TypeScript Definition Manager](https://github.com/typings/typings)
#### Test editing an exiting package
## List of definitions
To add new features you can use [module augmentation](http://www.typescriptlang.org/docs/handbook/declaration-merging.html).
You can also directly edit the types in `node_modules/@types/foo/index.d.ts`,
or copy them from there and paste inside of `declarations.d.ts` and follow the steps below.
* See [CONTRIBUTORS.md](CONTRIBUTORS.md)
## Requested definitions
#### Test a new package
* Add a new file `declarations.d.ts` to your project.
* Add it to the compilation, through `"includes"` or `"files"` in your [tsconfig](http://www.typescriptlang.org/docs/handbook/tsconfig-json.html),
or through a `/// <reference path="" />` declaration in your code.
* Inside `declarations.d.ts`, write `declare module "foo" { }`, then write the module declaration inside.
* Test that your code works.
* *Then*, once you've tested your definitions, make a PR contributing the definition.
### Make a pull request
Once you've tested your package, you can share it on DefinitelyTyped.
First, [fork](https://guides.github.com/activities/forking/) this repository.
Then inside your repository:
* `git checkout types-2.0`
New work should generally be done on the `types-2.0` branch.
If you want your changes to be available to `typings` users, then you may edit `master` instead.
#### Edit an existing package
* `cd my-package-to-edit`
* Make changes. Remember to edit tests.
* You may also want to add yourself to "Definitions by" section of the package header.
* `npm install -g typescript@2.0` and run `tsc`.
When you make a PR to edit an existing package, `dt-bot` should @-mention previous authors.
If it doesn't, you can do so yourself in the comment associated with the PR.
#### Create a new package
If you are the library author, or can make a pull request to the library, [bundle](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) types instead of publishing to DefinitelyTyped.
If you are adding typings for an NPM package, create a directory with the same name.
If the package you are adding typings for is not on NPM, make sure the name you choose for it does not conflict with the name of a package on NPM.
(You can use `npm info foo` to check for the existence of the `foo` package.)
Your package should have this structure:
| File | Purpose |
| --- | --- |
| index.d.ts | This contains the typings for the package. |
| foo-tests.ts | This contains sample code which tests the typings. This code does *not* run, but it is type-checked. |
| tsconfig.json | This allows you to run `tsc` within the package. |
`index.d.ts` should start with a header looking like:
```ts
// Type definitions for foo 1.2
// Project: https://github.com/baz/foo
// Definitions by: My Self <https://github.com/me>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
```
The `Project` link does not have to be to GitHub, but prefer linking to a source code repository rather than to a project website.
`tsconfig.json` should look like this:
```json
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": true,
"strictNullChecks": false,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"foo-tests.ts"
]
}
```
These should be identical accross projects except that `foo-tests` will be replaced with the name of your test file,
and you may also add the `"jsx"` compiler option if your library needs it.
DefinitelyTyped members routinely monitor for new PRs, though keep in mind that the number of other PRs may slow things down.
#### Common mistakes
* First, follow advice from the [handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/do-s-and-don-ts.html).
* Formatting: Either use all tabs, or always use 4 spaces. Also, always use semicolons, and use egyptian braces.
* `interface X {}`: An empty interface is essentially the `{}` type: it places no constraints on an object.
* `interface Foo { new(): Foo }`:
This defines a type of objects that are new-able. You probably want `declare class Foo { constructor(); }
* `namespace foo {}`:
Do not add a namespace just so that the `import * as foo` syntax will work.
If it is commonJs module with a single export, you should use the `import foo = require("foo")` syntax.
See more explanation [here](https://stackoverflow.com/questions/39415661/why-cant-i-import-a-class-or-function-with-import-as-x-from-y).
* `getMeAT<T>(): T`:
If a type parameter does not appear in the types of any parameters, you don't really have a generic function, you just have a disguised type assertion.
Prefer to use a real type assertion, e.g. `getMeAT() as number`.
Example where a type parameter is acceptable: `function id<T>(value: T): T;`.
Example where it is not acceptable: `function parseJson<T>(json: string): T;`.
Exception: `new Map<string, number>()` is OK.
#### Removing a package
When a package [bundles](http://www.typescriptlang.org/docs/handbook/declaration-files/publishing.html) its own types, types should be removed from DefinitelyTyped to avoid confusion.
Make a PR doing the following:
* Delete the directory.
* Add a new entry to `notNeededPackages.json`.
- `libraryName`: Descriptive name of the library, e.g. "Angular 2" instead of "angular2". (May be identical to "typingsPackageName".)
- `typingsPackageName`: This is the name of the directory you just deleted.
- `sourceRepoURL`: This should point to the repository that contains the typings.
- `asOfVersion`: A stub will be published to `@types/foo` with this version. Should be higher than any currently published version.
* Any other packages in DefinitelyTyped that referenced the deleted package should be updated to reference the bundled types.
To do this, add a `package.json` with `"dependencies": { "foo": "x.y.z" }`.
## FAQ
#### What exactly is the relationship between this repository and the `@types` packages on NPM?
The `types-2.0` branch is automatically published to the `@types` scope on NPM thanks to [types-publisher](https://github.com/Microsoft/types-publisher).
This usually happens within an hour of changes being merged.
Changes to the `master` branch are also manually merged into the `types-2.0` branch, but this takes longer.
#### I'm writing a definition that depends on another definition. Should I use `<reference types="" />` or an import?
If the module you're referencing is an written as an external module (uses `export`), use an import.
If the module you're referenceing is an ambient module (uses `declare module`, or just declares globals), use `<reference types="" />`.
#### What do I do about older versions of typings?
Currently we don't support this, though it is [planned](https://github.com/Microsoft/types-publisher/issues/3).
If you're adding a new major version of a library, you can copy `index.d.ts` to `foo-v2.3.d.ts` and edit `index.d.ts` to be the new version.
#### I notice some packages having a `package.json` here.
Usually you won't need this. When publishing a package we will normally automatically create a `package.json` for it.
A `package.json` may be included for the sake of specifying dependencies. Here's an [example](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/types-2.0/pikaday/package.json).
We do not allow other fields, such as `"description"`, to be defined manually.
Also, if you need to reference an older version of typings, you must do that by adding `"dependencies": { "@types/foo": "x.y.z" }` to the package.json.
#### Definitions in types-2.0 seem written differently than in master.
If you're targeting types-2.0, write it like the types-2.0 definitions.
If you're targeting master, we may change it to the new style when merging from master to types-2.0.
#### Can I request a definition?
Here are the [currently requested definitions](https://github.com/DefinitelyTyped/DefinitelyTyped/labels/Definition%3ARequest).
## License
This project is licensed under the MIT license.
+1
View File
@@ -158,6 +158,7 @@ declare module 'angular' {
hideDelay(delay: number): T;
position(position: string): T;
parent(parent?: string | Element | JQuery): T; // default: root node
toastClass(toastClass: string): T;
}
interface ISimpleToastPreset extends IToastPreset<ISimpleToastPreset> {
@@ -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");
}]
})
;
});
@@ -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
}
}
@@ -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"]
})
;
});
@@ -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[];
}
}
+22
View File
@@ -278,8 +278,14 @@ namespace TestQ {
b: string;
c: boolean;
}
interface TValue {
e: number;
f: boolean;
}
var tResult: TResult;
var promiseTResult: angular.IPromise<TResult>;
var tValue: TValue;
var promiseTValue: angular.IPromise<TValue>;
var $q: angular.IQService;
var promiseAny: angular.IPromise<any>;
@@ -348,6 +354,22 @@ namespace TestQ {
let result: angular.IPromise<TResult>;
result = $q.when<TResult>(tResult);
result = $q.when<TResult>(promiseTResult);
result = $q.when<TResult, TValue>(tValue, (result: TValue) => tResult);
result = $q.when<TResult, TValue>(tValue, (result: TValue) => tResult, (any) => any);
result = $q.when<TResult, TValue>(tValue, (result: TValue) => tResult, (any) => any, (any) => any);
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => tResult);
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => tResult, (any) => any);
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => tResult, (any) => any, (any) => any);
result = $q.when<TResult, TValue>(tValue, (result: TValue) => promiseTResult);
result = $q.when<TResult, TValue>(tValue, (result: TValue) => promiseTResult, (any) => any);
result = $q.when<TResult, TValue>(tValue, (result: TValue) => promiseTResult, (any) => any, (any) => any);
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => promiseTResult);
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => any);
result = $q.when<TResult, TValue>(promiseTValue, (result: TValue) => promiseTResult, (any) => any, (any) => any);
}
}
+1
View File
@@ -1043,6 +1043,7 @@ declare namespace angular {
* @param value Value or a promise
*/
when<T>(value: IPromise<T>|T): IPromise<T>;
when<TResult, T>(value: IPromise<T>|T, successCallback: (promiseValue: T) => IPromise<TResult>|TResult, errorCallback?: (reason: any) => any, notifyCallback?: (state: any) => any): IPromise<TResult>;
/**
* Wraps an object that might be a value or a (3rd party) then-able promise into a $q promise. This is useful when you are dealing with an object that might or might not be a promise, or if the promise comes from a source that can't be trusted.
*/
+28 -6
View File
@@ -1,10 +1,32 @@
var shouldBeString: string;
///////////////////////////////////////////////////////////////////////////////
// Variables
///////////////////////////////////////////////////////////////////////////////
let shouldBeString: string;
let testInputText: string = 'TEST';
declare var $sanitizeService: ng.sanitize.ISanitizeService;
shouldBeString = $sanitizeService(shouldBeString);
///////////////////////////////////////////////////////////////////////////////
// Test sanitize service
///////////////////////////////////////////////////////////////////////////////
declare let $sanitizeService: ng.sanitize.ISanitizeService;
shouldBeString = $sanitizeService(testInputText);
declare var $linky: ng.sanitize.filter.ILinky;
shouldBeString = $linky(shouldBeString);
shouldBeString = $linky(shouldBeString, shouldBeString);
///////////////////////////////////////////////////////////////////////////////
// Test `linky` filter
///////////////////////////////////////////////////////////////////////////////
declare let $linky: ng.sanitize.filter.ILinky;
// Should be string for simple text and target parameters
shouldBeString = $linky(testInputText, testInputText);
// Should be string for simple text, target and attributes parameters
let attributesAsFunction = () => {
};
shouldBeString = $linky(shouldBeString, testInputText, {
"attributeKey1": "attributeValue1",
"attributeKey2": "attributeValue2"
});
shouldBeString = $linky(shouldBeString, testInputText, (url: string) => {
return {"attributeKey1": "attributeValue1"}
});
+9 -1
View File
@@ -11,4 +11,12 @@ var readStream = FS.createReadStream('./archiver.d.ts');
archiver.pipe(writeStream);
archiver.append(readStream, {name: 'archiver.d.ts'});
archiver.finalize();
archiver.finalize();
archiver.directory('./path', './someOtherPath');
archiver.directory('./path', { name: "testName"} );
archiver.directory('./', "", {});
archiver.directory('./', {name: 'test'}, {});
archiver.bulk({ mappaing: {} });
+5
View File
@@ -25,6 +25,11 @@ interface nameInterface {
interface Archiver extends STREAM.Transform {
pipe(writeStream: FS.WriteStream): void;
append(source: FS.ReadStream | Buffer | string, name: nameInterface): void;
directory(dirpath: string, destpath: nameInterface | string): void;
directory(dirpath: string, destpath: nameInterface | string, data: any | Function): void;
bulk(mappings: any): void;
finalize(): void;
}
+64
View File
@@ -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();
+18
View File
@@ -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;
}
+57
View File
@@ -0,0 +1,57 @@
/// <reference path="awesomplete.d.ts" />
var input = document.getElementById("myinput");
new Awesomplete(input, {list: "#mylist"});
new Awesomplete(input, {list: document.querySelector("#mylist")});
new Awesomplete(input, {
list: ["Ada", "Java", "JavaScript", "LOLCODE", "Node.js", "Ruby on Rails"]
});
var awesomplete = new Awesomplete(input);
awesomplete.list = ["Ada", "Java", "JavaScript", "LOLCODE", "Node.js", "Ruby on Rails"];
new Awesomplete(input, {
list: [
{ label: "Belarus", value: "BY" },
{ label: "China", value: "CN" },
{ label: "United States", value: "US" }
]
});
// Same with arrays:
new Awesomplete(input, {
list: [
[ "Belarus", "BY" ],
[ "China", "CN" ],
[ "United States", "US" ]
]
});
new Awesomplete('input[type="email"]', {
list: ["aol.com", "att.net", "comcast.net", "facebook.com", "gmail.com", "gmx.com", "googlemail.com", "google.com", "hotmail.com", "hotmail.co.uk", "mac.com", "me.com", "mail.com", "msn.com", "live.com", "sbcglobal.net", "verizon.net", "yahoo.com", "yahoo.co.uk"],
data: function (text: string, input: any) {
return input.slice(0, input.indexOf("@")) + "@" + text;
},
filter: Awesomplete.FILTER_STARTSWITH
});
new Awesomplete('input[data-multiple]', {
filter: function(text: string, input: any) {
return Awesomplete.FILTER_CONTAINS(text, input.match(/[^,]*$/)[0]);
},
replace: function(text: string) {
var before = this.input.value.match(/^.+,\s*|/)[0];
this.input.value = before + text + ", ";
}
});
var ajax = new XMLHttpRequest();
ajax.open("GET", "https://restcountries.eu/rest/v1/lang/fr", true);
ajax.onload = function() {
var list = JSON.parse(ajax.responseText).map(function(i: any) { return i.name; });
new Awesomplete(document.querySelector("#ajax-example input"),{ list: list });
};
ajax.send();
+49
View File
@@ -0,0 +1,49 @@
// Type definitions for Awesomplete v1.1.0
// Project: https://leaverou.github.io/awesomplete/
// Definitions by: webbiesdk <https://github.com/webbiesdk/>, Ben Dixon <https://github.com/bmdixon/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare class Awesomplete {
constructor(input: Element | HTMLElement | string, o?: AwesompleteOptions);
static all: Array<any>;
static $$: (expr: string | NodeSelector, con?: any) => NodeList;
static ITEM: (text: string, input: string) => HTMLElement;
static $: {
(expr: string|Element, con?: NodeSelector): string | Element;
regExpEscape: (s: { replace: (arg0: RegExp, arg1: string) => void }) => any;
create: (tag: string, o: any) => HTMLElement;
fire: (target: EventTarget, type: string, properties: any) => any;
siblingIndex: (el: Element) => number;
};
static FILTER_STARTSWITH: (text: string, input: string) => boolean;
static FILTER_CONTAINS: (text: string, input: string) => boolean;
static SORT_BYLENGTH: (a: number | any[], b: number | any[]) => number;
static REPLACE: (text: any) => void;
next: () => void;
container: HTMLElement;
select: (selected?: HTMLElement, originalTarget?: HTMLElement) => void;
previous: () => void;
index: number;
opened: number;
list: string | string[] | Element | { label: string, value: any }[] | [string, string][];
input: HTMLElement | string;
goto: (i: number) => void;
ul: HTMLElement;
close: () => void;
evaluate: () => void;
selected: boolean;
open: () => void;
status: HTMLElement;
}
interface AwesompleteOptions {
list?: string | string[] | Element | { label: string, value: any }[] | [string, string][];
minChars?: Number;
maxItems?: Number;
autoFirst?: boolean;
data?: Function;
filter?: Function;
sort?: Function;
item?: Function;
replace?: Function;
}
+16 -7
View File
@@ -1,12 +1,12 @@
import lambda = require('aws-lambda');
var str: string;
var date: Date;
var anyObj: any;
var num: number;
var str: string = "any string";
var date: Date = new Date();
var anyObj: any = { abc: 123 };
var num: number = 5;
var identity: lambda.CognitoIdentity;
var error: Error;
var b: boolean;
var error: Error = new Error();
var b: boolean = true;
var clientCtx: lambda.ClientContext;
/* Context */
@@ -35,4 +35,13 @@ function callback(cb: lambda.Callback) {
cb(null);
cb(error);
cb(null, anyObj);
}
}
/* Compatibility functions */
context.done();
context.done(error);
context.done(error, anyObj);
context.succeed(str);
context.succeed(anyObj);
context.succeed(str, anyObj);
context.fail(error);
context.fail(str);
+3 -1
View File
@@ -23,7 +23,9 @@ interface Context {
getRemainingTimeInMillis(): number;
// Functions for compatibility with earlier Node.js Runtime v0.10.42
log(message: string, object: any): void;
// For more details see http://docs.aws.amazon.com/lambda/latest/dg/nodejs-prog-model-using-old-runtime.html#nodejs-prog-model-oldruntime-context-methods
done(error?: Error, result?: any): void;
fail(error: Error): void;
fail(message: string): void;
succeed(message: string): void;
succeed(object: any): void;
+2 -1
View File
@@ -522,7 +522,8 @@ export declare module DynamoDB {
interface UpdateParam extends _DDBDC_Writer {
Key: _DDBDC_Keys;
AttributeUpdates: {
UpdateExpression?: string;
AttributeUpdates?: {
[someKey: string]: {
Action: "PUT" | "ADD" | "DELETE";
Value: any
@@ -0,0 +1,29 @@
/// <reference path="./aws-serverless-express.d.ts" />
/// <reference path="../express/express.d.ts"/>
import * as awsServerlessExpress from 'aws-serverless-express';
import * as express from 'express';
const app = express();
const server = awsServerlessExpress.createServer(app, () => {});
const mockEvent = {
key: 'value'
};
const mockContext = {
callbackWaitsForEmptyEventLoop: true,
functionName: 'testFunction',
functionVersion: '1',
invokedFunctionArn: 'arn',
memoryLimitInMB: 128,
awsRequestId: 'id',
logGroupName: 'group',
logStreamName: 'stream',
getRemainingTimeInMillis: () => 2000,
done: () => false,
fail: (error: any) => false,
succeed: (message: string) => false
};
awsServerlessExpress.proxy(server, mockEvent, mockContext);
+24
View File
@@ -0,0 +1,24 @@
// Type definitions for aws-serverless-express
// Project: https://github.com/awslabs/aws-serverless-express
// Definitions by: Ben Speakman <https://github.com/threesquared>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts"/>
/// <reference path="../aws-lambda/aws-lambda.d.ts"/>
declare module 'aws-serverless-express' {
import * as http from 'http';
import * as lambda from 'aws-lambda';
export function createServer(
requestListener: (request: http.IncomingMessage, response: http.ServerResponse) => http.Server,
serverListenCallback?: () => any
): http.Server;
export function proxy(
server: http.Server,
event: any,
context: lambda.Context
): void;
}
+4
View File
@@ -69,6 +69,10 @@ axios.post("http://example.com/", {
]
});
var config: Axios.AxiosXHRConfigBase<any> = {headers: {}};
config.headers['X-Custom-Header'] = 'baz';
axios.post("http://example.com/", config);
var getRepoIssue = axios.get<Issue>("https://api.github.com/repos/mzabriskie/axios/issues/1");
var axiosInstance = axios.create({
+1 -1
View File
@@ -39,7 +39,7 @@ declare namespace Axios {
/**
* custom headers to be sent
*/
headers?: Object;
headers?: {[key: string]: any};
/**
* URL parameters to be sent with the request
+10
View File
@@ -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
+22
View File
@@ -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;
}
+1
View File
@@ -1,3 +1,4 @@
/// <reference types="bit-array" />
import BitArray = require("bit-array");
+1
View File
@@ -0,0 +1 @@
--noImplicitAny --module commonjs
+105
View File
@@ -0,0 +1,105 @@
// Type definitions for bit-array v0.2.2
// Project: https://github.com/bramstein/bit-array
// Definitions by: Mudkip <https://github.com/mudkipme>
// Definitions: https://github.com/mudkipme/DefinitelyTyped
declare module "bit-array" {
class BitArray {
/**
* Creates a new empty BitArray with the given length or initialises the BitArray with the given hex representation.
*/
constructor(size: number, hex?: string);
/**
* Returns the total number of bits in this BitArray.
*/
size(): number;
/**
* Sets the bit at index to a value (boolean.)
*/
set(index: number, value: boolean): BitArray;
/**
* Toggles the bit at index. If the bit is on, it is turned off. Likewise, if the bit is off it is turned on.
*/
toggle(index: number): BitArray;
/**
* Returns the value of the bit at index (boolean.)
*/
get(index: number): boolean;
/**
* Resets the BitArray so that it is empty and can be re-used.
*/
reset(): BitArray;
/**
* Returns a copy of this BitArray.
*/
copy(): BitArray;
/**
* Returns true if this BitArray equals another. Two BitArrays are considered
* equal if both have the same length and bit pattern.
*/
equals(x: BitArray): boolean;
/**
* Returns the JSON representation of this BitArray.
*/
toJSON(): string;
/**
* Returns a string representation of the BitArray with bits
* in mathemetical order.
*/
toBinaryString(): string;
/**
* Returns a hexadecimal string representation of the BitArray
* with bits in logical order.
*/
toHexString(): string;
/**
* Returns a string representation of the BitArray with bits
* in logical order.
*/
toString(): string;
/**
* Convert the BitArray to an Array of boolean values (slow).
*/
toArray(): boolean[];
/**
* Returns the total number of bits set to one in this BitArray.
*/
count(): number;
/**
* Inverts this BitArray.
*/
not(): BitArray;
/**
* Bitwise OR on the values of this BitArray using BitArray x.
*/
or(x: BitArray): BitArray;
/**
* Bitwise AND on the values of this BitArray using BitArray x.
*/
and(x: BitArray): BitArray;
/**
* Bitwise XOR on the values of this BitArray using BitArray x.
*/
xor(x: BitArray): BitArray;
}
export = BitArray;
}
+21
View File
@@ -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);
+71
View File
@@ -0,0 +1,71 @@
// Type definitions for bonjour v3.5.0
// Project: https://github.com/watson/bonjour
// Definitions by: Quentin Lampin <https://github.com/quentin-ol/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "bonjour" {
export interface BonjourOptions {
multicast?: boolean;
interface?: string;
port?: number;
ip?: string;
ttl?: number;
loopback?: boolean;
reuseAddr?: boolean;
}
export interface BrowserOptions {
type?: string;
subtypes?: string[];
protocol?: string;
txt?: Object;
}
export interface ServiceOptions {
name: string;
host?: string;
port: number;
type: string;
subtypes?: string[];
protocol?: 'udp'|'tcp';
txt?: Object;
}
export interface Service {
name: string;
type: string;
subtypes: string[];
protocol: string;
host: string;
port: number;
fqdn: string;
rawTxt: Object;
txt: Object;
published: boolean;
stop: (cb: ()=>any) => void;
start: () => void;
}
export class Bonjour {
constructor(opts: BonjourOptions);
publish(options: ServiceOptions):Service;
unpublishAll(cb: ()=>any): void;
find(options:BrowserOptions, onUp: ()=>any): Browser;
findOne(options:any, cb: (service: Service)=>any): Browser;
destroy():void;
}
export class Browser {
services: Service[];
start():void;
update():void;
stop():void;
}
export function find(options: BrowserOptions, onUp?: ()=>any): Browser;
export function findOne(options: BrowserOptions): Browser;
}
+1
View File
@@ -40,6 +40,7 @@ interface BootboxConfirmOptions extends BootboxDialogOptions {
interface BootboxPromptOptions extends BootboxBaseOptions {
title: string;
value?: string;
inputType?: string;
callback: (result: string) => any;
buttons?: BootboxConfirmPromptButtonMap;
}
+1
View File
@@ -36,6 +36,7 @@ interface DatepickerOptions {
multidateSeparator?: string;
orientation?: string;
assumeNearbyYear?: any;
viewMode?: string;
}
interface DatepickerCustomFormatOptions {
+12
View File
@@ -0,0 +1,12 @@
// Type definitions for Bootstrap Table v1.11.0
// Project: http://bootstrap-table.wenzhixin.net.cn/
// Definitions by: Talat Baig <https://github.com/talatbaig/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../jquery/jquery.d.ts" />
interface JQuery {
bootstrapTable(options?: any): JQuery;
}
declare var bootstrapTable: JQueryStatic;
+11 -3
View File
@@ -48,10 +48,18 @@ braintree.client.create({
selector: '#card-number'
},
cvv: {
selector: '#cvv'
selector: '#cvv',
type: 'password'
},
expirationDate: {
selector: '#expiration-date'
expirationMonth: {
selector: '#expiration-month',
select: {
options: ["01 - Jan", "02 - Feb", "03 - Mar", "04 - Apr", "05 - May", "06 - Jun", "07 - Jul", "08 - Aug", "09 - Sep", "10 - Oct", "11 - Nov", "12 - Dec"]
}
},
expirationYear: {
selector: '#expiration-year',
select: true
}
}
}, function (hostedFieldsErr?: BraintreeError, hostedFieldsInstance?: any) {
+7 -2
View File
@@ -1,4 +1,4 @@
// Type definitions for Braintree-web v3.0.2
// Type definitions for Braintree-web v3.5.0
// Project: https://github.com/braintree/braintree-web
// Definitions by: Guy Shahine <https://github.com/chlela>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -540,12 +540,17 @@ declare namespace BraintreeWeb {
* @typedef {object} field
* @property {string} selector A CSS selector to find the container where the hosted field will be inserted.
* @property {string} [placeholder] Will be used as the `placeholder` attribute of the input. If `placeholder` is not natively supported by the browser, it will be polyfilled.
* @property {boolean} [formatInput=true] - Enable or disable automatic formatting on this field. Note: Input formatting does not work properly on Android and iOS, so input formatting is automatically disabled on those browsers.
* @property {string} [type] Will be used as the `type` attribute of the input. To mask `cvv` input, for instance, `type: "password"` can be used.
* @property {boolean} [formatInput=true] - Enable or disable automatic formatting on this field.
* @property {object|boolean} [select] If truthy, this field becomes a `<select>` dropdown list. This can only be used for `expirationMonth` and `expirationYear` fields.
* @property {string[]} [select.options] An array of 12 strings, one per month. This can only be used for the `expirationMonth` field. For example, the array can look like `['01 - January', '02 - February', ...]`.
*/
interface HostedFieldsField {
selector: string;
placeholder?: string;
type?: string;
formatInput?: boolean;
select?: boolean | { options: string[] };
}
/**
+2 -2
View File
@@ -1,4 +1,4 @@
// Type definitions for bull 0.7.0
// Type definitions for bull 1.0.0
// Project: https://github.com/OptimalBits/bull
// Definitions by: Bruno Grieder <https://github.com/bgrieder>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -24,7 +24,7 @@ declare module "bull" {
export interface Job {
id: string
jobId: string
/**
* The custom data passed when the job was created
+31
View File
@@ -0,0 +1,31 @@
// Type definitions for bunyan-config 0.2.0
// Project: https://github.com/LSEducation/bunyan-config
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../bunyan/bunyan.d.ts"/>
declare module "bunyan-config" {
import * as bunyan from "bunyan";
/**
* Configuration.
* @interface
*/
interface Configuration {
name: string;
streams?: bunyan.Stream[];
level?: string | number;
stream?: NodeJS.WritableStream;
serializers?: {};
src?: boolean;
}
/**
* Constructor.
* @param {Configuration} [jsonConfig] A JSON configuration.
* @return {LoggerOptions} A logger options.
*/
function bunyanConfig(jsonConfig?: Configuration): bunyan.LoggerOptions;
export = bunyanConfig;
}
+13
View File
@@ -55,7 +55,20 @@ var options:bunyan.LoggerOptions = {
var log = bunyan.createLogger(options);
var customSerializer = function(anything: any) {
return { obj: anything};
};
log.addSerializers({anything: customSerializer});
log.addSerializers(bunyan.stdSerializers);
log.addSerializers(
{
err: bunyan.stdSerializers.err,
req: bunyan.stdSerializers.req,
res: bunyan.stdSerializers.res
}
);
var child = log.child({name: 'child'});
child.reopenFileStreams();
log.addStream({path: '/dev/null'});
+14 -4
View File
@@ -11,7 +11,7 @@ import { EventEmitter } from 'events';
declare class Logger extends EventEmitter {
constructor(options: LoggerOptions);
addStream(stream: Stream): void;
addSerializers(serializers: Serializers): void;
addSerializers(serializers:Serializers | StdSerializers):void;
child(options: LoggerOptions, simple?: boolean): Logger;
child(obj: Object, simple?: boolean): Logger;
reopenFileStreams(): void;
@@ -21,7 +21,7 @@ declare class Logger extends EventEmitter {
levels(name: number | string, value: number | string): void;
fields: any;
src: boolean;
src:boolean;
trace(error: Error, format?: any, ...params: any[]): void;
trace(buffer: Buffer, format?: any, ...params: any[]): void;
@@ -58,8 +58,18 @@ interface LoggerOptions {
src?: boolean;
}
interface Serializer {
(input:any): any;
}
interface Serializers {
[key: string]: (input: any) => string;
[key:string]: Serializer;
}
interface StdSerializers {
err: Serializer;
res: Serializer;
req: Serializer;
}
interface Stream {
@@ -72,7 +82,7 @@ interface Stream {
count?: number;
}
export declare var stdSerializers: Serializers;
export var stdSerializers:StdSerializers;
export declare var TRACE: number;
export declare var DEBUG: number;
+43
View File
@@ -0,0 +1,43 @@
/// <reference path="./bwip-js.d.ts" />
/// <reference path="../node/node.d.ts" />
'use strict';
import * as bwipjs from 'bwip-js';
import * as http from 'http';
import * as fs from 'fs';
bwipjs.loadFont('Inconsolata', 108,
fs.readFileSync('fonts/Inconsolata.otf', 'binary'));
http.createServer(function(req, res) {
// If the url does not begin /?bcid= then 404. Otherwise, we end up
// returning 400 on requests like favicon.ico.
if (req.url.indexOf('/?bcid=') != 0) {
res.writeHead(404, { 'Content-Type':'text/plain' });
res.end('BWIPJS: Unknown request format.', 'utf8');
} else {
bwipjs(req, res);
}
}).listen(3030);
bwipjs.toBuffer({
bcid: 'code128', // Barcode type
text: '0123456789', // Text to encode
scale: 3, // 3x scaling factor
height: 10, // Bar height, in millimeters
includetext: true, // Show human-readable text
textxalign: 'center', // Always good to set this
textfont: 'Inconsolata', // Use your custom font
textsize: 13 // Font size, in points
}, function (err:string|Error, png: Buffer) {
if (err) {
console.log(err);
} else {
// `png` is a Buffer
// png.length : PNG file length
// png.readUInt32BE(16) : PNG image width
// png.readUInt32BE(20) : PNG image height
}
});
+86
View File
@@ -0,0 +1,86 @@
// Type definitions for bwip-js 1.1.1
// Project: https://github.com/metafloor/bwip-js
// Definitions by: TANAKA Koichi <https://github.com/MugeSo/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module 'bwip-js' {
import {IncomingMessage as Request, ServerResponse as Response} from 'http';
module BwipJs {
export function loadFont(fontName:string, sizeMulti: number, fontFile: string): void;
export function toBuffer(opts: ToBufferOptions, callback:(err: string|Error, png: Buffer) => void): void;
interface ToBufferOptions {
bcid: string;
text: string;
parse?: boolean;
parsefunc?: boolean;
height?: number;
width?: number;
scaleX?: number;
scaleY?: number;
scale?: number;
rotate?: 'N'|'R'|'L'|'I';
paddingwidth?: number;
paddingheight?: number;
monochrome?: boolean;
alttext?: boolean;
includetext?: boolean;
textfont?: string;
textsize?: number;
textgaps?: number;
textxalign?:'offleft'|'left'|'center'|'right'|'offright'|'justify';
textyalign?:'below'|'center'|'above';
textxoffset?: number;
textyoffset?: number;
showborder?: boolean;
borderwidth?: number;
borderleft?: number;
borderright?: number;
bordertop?: number;
boraderbottom?: number;
barcolor?: string;
backgroundcolor?: string;
bordercolor?: string;
textcolor?: string;
addontextxoffset?: number;
addontextyoffset?: number;
addontextfont?: string;
addontextsize?: number;
guardwhitespace?: boolean;
guardwidth?: number;
guardheight?: number;
guardleftpos?: number;
guardrightpos?: number;
guardleftypos?: number;
guardrightypos?: number;
sizelimit?: number;
includecheck?: boolean;
includecheckintext?: boolean;
inkspread?: number;
inkspreadh?: number;
inkspreadv?: number;
}
}
function BwipJs(req: Request, res: Response, opts?:BwipJs.ToBufferOptions): void;
export = BwipJs;
}
+3 -2
View File
@@ -6,8 +6,9 @@
import fs = require( 'fs' );
import byline = require( 'byline' );
//TODO can this be typed in an ambient way?
//var stream = byline( fs.createReadStream( 'sample.txt', {encoding: 'utf8'} ) );
var stream = byline();
var stream = byline( fs.createReadStream( 'sample.txt', {encoding: 'utf8'} ) );
var stream = byline.createStream( fs.createReadStream( 'sample.txt', {encoding: 'utf8'} ) );
+32 -25
View File
@@ -7,31 +7,38 @@
import stream = require("stream");
declare function bl(): bl.LineStream;
declare function bl(stream: NodeJS.ReadableStream, options?: bl.LineStreamOptions): bl.LineStream;
export interface LineStreamOptions extends stream.TransformOptions {
keepEmptyLines?: boolean;
declare namespace bl {
export interface LineStreamOptions extends stream.TransformOptions {
keepEmptyLines?: boolean;
}
export interface LineStream extends stream.Transform {
}
export interface LineStreamCreatable extends LineStream {
new (options?: LineStreamOptions): LineStream
}
//TODO is it possible to declare static factory functions without name (directly on the module)
//
// JS:
// // convinience API
// module.exports = function(readStream, options) {
// return module.exports.createStream(readStream, options);
// };
//
// TS:
// ():LineStream; // same as createStream():LineStream
// (stream:stream.Stream, options?:LineStreamOptions):LineStream; // same as createStream(stream, options?):LineStream
export function createStream(): LineStream;
export function createStream(stream: NodeJS.ReadableStream, options?: LineStreamOptions): LineStream;
export var LineStream: LineStreamCreatable;
}
export interface LineStream extends stream.Transform {
}
export interface LineStreamCreatable extends LineStream {
new (options?: LineStreamOptions): LineStream
}
//TODO is it possible to declare static factory functions without name (directly on the module)
//
// JS:
// // convinience API
// module.exports = function(readStream, options) {
// return module.exports.createStream(readStream, options);
// };
//
// TS:
// ():LineStream; // same as createStream():LineStream
// (stream:stream.Stream, options?:LineStreamOptions):LineStream; // same as createStream(stream, options?):LineStream
export declare function createStream(): LineStream;
export declare function createStream(stream: NodeJS.ReadableStream, options?: LineStreamOptions): LineStream;
export declare var LineStream: LineStreamCreatable;
export = bl;
+68 -43
View File
@@ -7,19 +7,20 @@
declare class CamlBuilder {
constructor();
/** Generate CAML Query, starting from <Where> tag */
public Where(): CamlBuilder.IFieldExpression;
Where(): CamlBuilder.IFieldExpression;
/** Generate <View> tag for SP.CamlQuery
@param viewFields If omitted, default view fields are requested; otherwise, only values for the fields with the specified internal names are returned.
Specifying view fields is a good practice, as it decreases traffic between server and client. */
public View(viewFields?: string[]): CamlBuilder.IView;
@param viewFields If omitted, default view fields are requested; otherwise, only values for the fields with the specified internal names are returned.
Specifying view fields is a good practice, as it decreases traffic between server and client. */
View(viewFields?: string[]): CamlBuilder.IView;
/** Generate <ViewFields> tag for SPServices */
public ViewFields(viewFields: string[]): CamlBuilder.IFinalizableToString;
ViewFields(viewFields: string[]): CamlBuilder.IFinalizableToString;
/** Use for:
1. SPServices CAMLQuery attribute
2. Creating partial expressions
3. In conjunction with Any & All clauses
*/
1. SPServices CAMLQuery attribute
2. Creating partial expressions
3. In conjunction with Any & All clauses
*/
static Expression(): CamlBuilder.IFieldExpression;
static FromXml(xml: string): CamlBuilder.IRawQuery;
}
declare namespace CamlBuilder {
interface IView extends IJoinable, IFinalizable {
@@ -29,24 +30,24 @@ declare namespace CamlBuilder {
}
interface IJoinable {
/** Join the list you're querying with another list.
Joins are only allowed through a lookup field relation.
@param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in.
@alias alias for the joined list */
Joins are only allowed through a lookup field relation.
@param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in.
@alias alias for the joined list */
InnerJoin(lookupFieldInternalName: string, alias: string): IJoin;
/** Join the list you're querying with another list.
Joins are only allowed through a lookup field relation.
@param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in.
@alias alias for the joined list */
Joins are only allowed through a lookup field relation.
@param lookupFieldInternalName Internal name of the lookup field, that points to the list you're going to join in.
@alias alias for the joined list */
LeftJoin(lookupFieldInternalName: string, alias: string): IJoin;
}
interface IJoin extends IJoinable {
/** Select projected field for using in the main Query body
@param remoteFieldAlias By this alias, the field can be used in the main Query body. */
@param remoteFieldAlias By this alias, the field can be used in the main Query body. */
Select(remoteFieldInternalName: string, remoteFieldAlias: string): IProjectableView;
}
interface IProjectableView extends IView {
/** Select projected field for using in the main Query body
@param remoteFieldAlias By this alias, the field can be used in the main Query body. */
@param remoteFieldAlias By this alias, the field can be used in the main Query body. */
Select(remoteFieldInternalName: string, remoteFieldAlias: string): IProjectableView;
}
enum ViewScope {
@@ -57,7 +58,7 @@ declare namespace CamlBuilder {
/** */
FilesOnly = 2,
}
interface IQuery {
interface IQuery extends IGroupable {
Where(): IFieldExpression;
}
interface IFinalizableToString {
@@ -70,21 +71,21 @@ declare namespace CamlBuilder {
}
interface ISortable extends IFinalizable {
/** Adds OrderBy clause to the query
@param fieldInternalName Internal field of the first field by that the data will be sorted (ascending)
@param override This is only necessary for large lists. DON'T use it unless you know what it is for!
@param useIndexForOrderBy This is only necessary for large lists. DON'T use it unless you know what it is for!
@param fieldInternalName Internal field of the first field by that the data will be sorted (ascending)
@param override This is only necessary for large lists. DON'T use it unless you know what it is for!
@param useIndexForOrderBy This is only necessary for large lists. DON'T use it unless you know what it is for!
*/
OrderBy(fieldInternalName: string, override?: boolean, useIndexForOrderBy?: boolean): ISortedQuery;
/** Adds OrderBy clause to the query (using descending order for the first field).
@param fieldInternalName Internal field of the first field by that the data will be sorted (descending)
@param override This is only necessary for large lists. DON'T use it unless you know what it is for!
@param useIndexForOrderBy This is only necessary for large lists. DON'T use it unless you know what it is for!
@param fieldInternalName Internal field of the first field by that the data will be sorted (descending)
@param override This is only necessary for large lists. DON'T use it unless you know what it is for!
@param useIndexForOrderBy This is only necessary for large lists. DON'T use it unless you know what it is for!
*/
OrderByDesc(fieldInternalName: string, override?: boolean, useIndexForOrderBy?: boolean): ISortedQuery;
}
interface IGroupable extends ISortable {
/** Adds GroupBy clause to the query.
@param collapse If true, only information about the groups is retrieved, otherwise items are also retrieved. */
@param collapse If true, only information about the groups is retrieved, otherwise items are also retrieved. */
GroupBy(fieldInternalName: any): IGroupedQuery;
}
interface IExpression extends IGroupable {
@@ -134,17 +135,19 @@ declare namespace CamlBuilder {
DateField(internalName: string): IDateTimeFieldExpression;
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is DateTime */
DateTimeField(internalName: string): IDateTimeFieldExpression;
/** Specifies that a condition will be tested against the field with the specified internal name, and the type of this field is ModStat (moderation status) */
ModStatField(internalName: string): IModStatFieldExpression;
/** Used in queries for retrieving recurring calendar events.
NOTICE: DateRangesOverlap with overlapType other than Now cannot be used with SP.CamlQuery, because it doesn't support
CalendarDate and ExpandRecurrence query options. Lists.asmx, however, supports them, so you can still use DateRangesOverlap
with SPServices.
@param overlapType Defines type of overlap: return all events for a day, for a week, for a month or for a year
@param calendarDate Defines date that will be used for determining events for which exactly day/week/month/year will be returned.
This value is ignored for overlapType=Now, but for the other overlap types it is mandatory.
@param eventDateField Internal name of "Start Time" field (default: "EventDate" - all OOTB Calendar lists use this name)
@param endDateField Internal name of "End Time" field (default: "EndDate" - all OOTB Calendar lists use this name)
@param recurrenceIDField Internal name of "Recurrence ID" field (default: "RecurrenceID" - all OOTB Calendar lists use this name)
*/
NOTICE: DateRangesOverlap with overlapType other than Now cannot be used with SP.CamlQuery, because it doesn't support
CalendarDate and ExpandRecurrence query options. Lists.asmx, however, supports them, so you can still use DateRangesOverlap
with SPServices.
@param overlapType Defines type of overlap: return all events for a day, for a week, for a month or for a year
@param calendarDate Defines date that will be used for determining events for which exactly day/week/month/year will be returned.
This value is ignored for overlapType=Now, but for the other overlap types it is mandatory.
@param eventDateField Internal name of "Start Time" field (default: "EventDate" - all OOTB Calendar lists use this name)
@param endDateField Internal name of "End Time" field (default: "EndDate" - all OOTB Calendar lists use this name)
@param recurrenceIDField Internal name of "Recurrence ID" field (default: "RecurrenceID" - all OOTB Calendar lists use this name)
*/
DateRangesOverlap(overlapType: DateRangesOverlapType, calendarDate: string, eventDateField?: string, endDateField?: string, recurrenceIDField?: string): IExpression;
}
interface IBooleanFieldExpression {
@@ -201,25 +204,25 @@ declare namespace CamlBuilder {
/** Checks whether the value of the field is equal to one of the specified values */
In(arrayOfValues: Date[]): IExpression;
/** Checks whether the value of the field is equal to the specified value.
The datetime value should be defined in ISO 8601 format! */
The datetime value should be defined in ISO 8601 format! */
EqualTo(value: string): IExpression;
/** Checks whether the value of the field is not equal to the specified value.
The datetime value should be defined in ISO 8601 format! */
The datetime value should be defined in ISO 8601 format! */
NotEqualTo(value: string): IExpression;
/** Checks whether the value of the field is greater than the specified value.
The datetime value should be defined in ISO 8601 format! */
The datetime value should be defined in ISO 8601 format! */
GreaterThan(value: string): IExpression;
/** Checks whether the value of the field is less than the specified value.
The datetime value should be defined in ISO 8601 format! */
The datetime value should be defined in ISO 8601 format! */
LessThan(value: string): IExpression;
/** Checks whether the value of the field is greater than or equal to the specified value.
The datetime value should be defined in ISO 8601 format! */
The datetime value should be defined in ISO 8601 format! */
GreaterThanOrEqualTo(value: string): IExpression;
/** Checks whether the value of the field is less than or equal to the specified value.
The datetime value should be defined in ISO 8601 format! */
The datetime value should be defined in ISO 8601 format! */
LessThanOrEqualTo(value: string): IExpression;
/** Checks whether the value of the field is equal to one of the specified values.
The datetime value should be defined in ISO 8601 format! */
The datetime value should be defined in ISO 8601 format! */
In(arrayOfValues: string[]): IExpression;
}
interface ITextFieldExpression {
@@ -322,6 +325,27 @@ declare namespace CamlBuilder {
/** DEPRECATED: "Neq" operation in CAML works exactly the same as "NotIncludes". To avoid confusion, please use NotIncludes. */
NotEqualTo(value: any): IExpression;
}
interface IModStatFieldExpression {
/** Represents moderation status ID. */
ModStatId(): INumberFieldExpression;
/** Checks whether the value of the field is Approved - same as ModStatId.EqualTo(0) */
IsApproved(): IExpression;
/** Checks whether the value of the field is Rejected - same as ModStatId.EqualTo(1) */
IsRejected(): IExpression;
/** Checks whether the value of the field is Pending - same as ModStatId.EqualTo(2) */
IsPending(): IExpression;
/** Represents moderation status as localized text. In most cases it is better to use ModStatId in the queries instead of ValueAsText. */
ValueAsText(): ITextFieldExpression;
}
interface IRawQuery {
/** Change Where clause */
ReplaceWhere(): IFieldExpression;
ModifyWhere(): IRawQueryModify;
}
interface IRawQueryModify {
AppendOr(): IFieldExpression;
AppendAnd(): IFieldExpression;
}
enum DateRangesOverlapType {
/** Returns events for today */
Now = 0,
@@ -330,7 +354,7 @@ declare namespace CamlBuilder {
/** Returns events for one week, specified by CalendarDate in QueryOptions */
Week = 2,
/** Returns events for one month, specified by CalendarDate in QueryOptions.
Caution: usually also returns few days from previous and next months */
Caution: usually also returns few days from previous and next months */
Month = 3,
/** Returns events for one year, specified by CalendarDate in QueryOptions */
Year = 4,
@@ -340,6 +364,7 @@ declare namespace CamlBuilder {
static createViewFields(viewFields: string[]): IFinalizableToString;
static createWhere(): IFieldExpression;
static createExpression(): IFieldExpression;
static createRawQuery(xml: string): IRawQuery;
}
class CamlValues {
/** Dynamic value that represents Id of the current user */
+1 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for canvas-gauges
// Type definitions for canvas-gauges v2.0.8
// Project: https://github.com/Mikhus/canvas-gauges
// Definitions by: Mikhus <https://github.com/Mikhus>
// Definitions: https://github.com/Mikhus/DefinitelyTyped
+495
View File
@@ -0,0 +1,495 @@
// Type definitions for Cash
// Project: https://github.com/kenwheeler/cash
// Definitions by: Ashok Vishwakarma <https://github.com/akvlko>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* OffsetType
* return type for cash.offset(), cash.position()
*/
interface OffsetType {
top: number;
left: number;
}
/**
* CashStatic
* Static declaration for CashJs accessible directly using Cash object or $
*/
interface CashStatic {
/**
* isArray
* Check if the argument is an array.
* @type method
* @argument any
* @return boolean
*/
isArray(n: any): boolean;
/**
* isFunction
* Check if the argument is a function.
* @type method
* @argument any
* @return boolean
*/
isFunction(n: any): boolean;
/**
* isNumeric
* Check if the argument is numeric.
* @type method
* @type method
* @argument any
* @return boolean
*/
isNumeric(n: any): boolean;
/**
* isString
* Check if the argument is a string.
* @type method
* @argument str any
* @return boolean
*/
isString(str: any): boolean;
/**
* extend
* Extends target object with properties from the source object. If no target is provided, cash itself will be extended.
* @type method
* @argument target any, source any
*/
extend(target: any, source: any): any;
/**
* matches
* Checks a selector against an element, returning a boolean value for match.
* @type method
* @argument element Cash, selector string
* @return boolean
*/
matches(element: Cash, selector: string): boolean;
/**
* parseHTML
* Returns a collection from an HTML string.
* @type method
* @argument htmlString string
* @return Cash
*/
parseHTML(htmlString: string): Cash;
/**
* each
* Iterates through a collection and calls the callback method on each.
* @type method
* @argument collection Array, callback Function
* @return Array
*/
each(collection: Array<any>, callback: Function): Array<any>;
/**
* fn: use to extend cash for plugin development
* @type property
*/
fn: any;
/**
* selector declaration for Cash to use $(<argument>)
*/
(selector: string, context?: Element|Cash): Cash;
(element: Element): Cash;
(elementArray: Element[]): Cash;
}
/**
* Cash
* Interface for CashJs
* Refer https://github.com/kenwheeler/cash for documentation and uses of the methods and properties
*/
interface Cash {
/**
* add
* Returns a new collection with the element(s) added to the end.
*/
add(selector: string|Cash|Element, context?: Element): Cash;
/**
* addClass
* Adds the className argument to collection elements.
*/
addClass(c: string): Cash;
/**
* after
* Inserts content or elements after the collection.
*/
after(selector: Element|String): Cash;
/**
* append
* Appends the target element to the each element in the collection.
*/
append(content: string|Element|Cash): Cash;
/**
* appendTo
* Adds the elements in a collection to the target element(s).
*/
appendTo(parent: string|Element|Cash): Cash;
/**
* attr
* Without attrValue, returns the attribute value of the first element in the collection.
* With attrValue, sets the attribute value of each element of the collection.
*/
attr(name: string): any;
attr(name: string, value: string): Cash;
/**
* before
* Inserts content or elements before the collection.
*/
before(selector: string|Element): Cash;
/**
* children
* Without a selector specified, returns a collection of child elements.
* With a selector, returns child elements that match the selector.
*/
children(selector?: string): Cash;
/**
* closest
* Returns the closest matching selector up the DOM tree.
*/
closest(selector?: string): Cash;
/**
* clone
* Returns a clone of the collection.
*/
clone(): Cash;
/**
* css
* Returns a CSS property value when just property is supplied.
* Sets a CSS property when property and value are supplied, and set multiple properties when an object is supplied.
* Properties will be autoprefixed if needed for the user's browser.
*/
css(prop: any): any;
css(prop: string, value: any): Cash;
/**
* data
* Link some data (string, object, array, etc.) to an element when both key and value are supplied.
* If only a key is supplied, returns the linked data and falls back to data attribute value if no data is already linked.
* Multiple data can be set when an object is supplied.
*/
data(name: any): any;
data(name: string, value: any): Cash;
/**
* each
* Iterates over a collection with callback(value, index, array).
*/
each(callback: Function): Cash;
/**
* empty
* Empties an elements interior markup.
*/
empty(): Cash;
/**
* eq
* Returns a collection with the element at index.
*/
eq(index: number): Cash;
/**
* extend
* Adds properties to the cash collection prototype.
*/
extend(target: any): any;
/**
* filter
* Returns the collection that results from applying the filter method.
*/
filter(selector: Function): Cash;
/**
* find
* Returns selector match descendants from the first element in the collection.
*/
find(selector: string): Cash;
/**
* first
* Returns the first element in the collection.
*/
first(): Cash;
/**
* get
* Returns the element at the index.
*/
get(index: number): HTMLElement;
/**
* has
* Returns boolean result of the selector argument against the collection.
*/
has(selector: string): boolean;
/**
* hasClass
* Returns the boolean result of checking if the first element in the collection has the className attribute.
*/
hasClass(c: string): boolean;
/**
* height
* Returns the height of the element.
*/
height(): number;
/**
* html
* Returns the HTML text of the first element in the collection, sets the HTML if provided.
*/
html(): string;
html(content: string): Cash;
/**
* index
* Returns the index of the element in its parent if an element or selector isn't provided.
* Returns index within element or selector if it is.
*/
index(elem?: Element): number;
/**
* innerHeight
* Returns the height of the element + padding.
*/
innerHeight(): number;
/**
* innerWidth
* Returns the width of the element + padding.
*/
innerWidth(): number;
/**
* insertAfter
* Inserts collection after specified element.
*/
insertAfter(selector: string|Element|Cash): Cash;
/**
* insertBefore
* Inserts collection before specified element.
*/
insertBefore(selector: string|Element|Cash): Cash;
/**
* is
* Returns whether the provided selector, element or collection matches any element in the collection.
*/
is(selector: string|Element|Cash): boolean;
/**
* last
* Returns last element in the collection.
*/
last(): Cash;
/**
* next
* Returns next sibling.
*/
next(): Cash;
/**
* not
* Filters collection by false match on selector.
*/
not(selector: string|Element|Cash): Cash;
/**
* off
* Removes event listener from collection elements.
*/
off(eventName: string, callback: Function): Cash;
/**
* offset
* Get the coordinates of the first element in a collection relative to the document.
*/
offset(): OffsetType;
/**
* offsetParent
* Get the first element's ancestor that's positioned.
*/
offsetParent(): OffsetType;
/**
* on
* Adds event listener to collection elements. Event is delegated if delegate is supplied.
*/
on(eventName: string|Array<string>, delegate: any, callback?: Function, runOnce?: boolean): Cash;
/**
* one
* Adds event listener to collection elements that only triggers once for each element.
* Event is delegated if delegate is supplied.
*/
one(eventName: string|Array<string>, delegate: any, callback?: Function, runOnce?: boolean): Cash;
/**
* outerHeight
* Returns the outer height of the element. Includes margins if margin is set to true.
*/
outerHeight(flag?: boolean): number;
/**
* outerWidth
* Returns the outer width of the element. Includes margins if margin is set to true.
*/
outerWidth(flag?: boolean): number;
/**
* parent
* Returns parent element.
*/
parent(): Cash;
/**
* parents
* Returns collection of elements who are parents of element. Optionally filtering by selector.
*/
parents(selector?: string): Cash;
/**
* position
* Get the coordinates of the first element in a collection relative to its offsetParent.
*/
position(): OffsetType;
/**
* prepend
* Prepends element to the each element in collection.
*/
prepend(content: string): Cash;
/**
* prependTo
* Prepends elements in a collection to the target element(s).
*/
prependTo(parent: string|Element|Cash): Cash;
/**
* prev
* Returns the previous adjacent element.
*/
prev(): Cash;
/**
* prop
* Returns a property value when just property is supplied.
* Sets a property when property and value are supplied, and sets multiple properties when an object is supplied.
*/
prop(name: string): any;
prop(name: string, value: string): Cash;
/**
* ready
* Calls callback method on DOMContentLoaded.
*/
ready(fn: Function): void;
/**
* remove
* Removes collection elements from the DOM.
*/
remove(): Cash;
/**
* removeAttr
* Removes attribute from collection elements.
*/
removeAttr(name: string): Cash;
/**
* removeClass
* Removes className from collection elements.
* Accepts space-separated classNames for removing multiple classes.
* Providing no arguments will remove all classes.
*/
removeClass(c?: string): Cash;
/**
* removeData
* Removes linked data and data-attributes from collection elements.
*/
removeData(key: string): Cash;
/**
* removeProp
* Removes property from collection elements.
*/
removeProp(name: string): Cash;
/**
* serialize
* When called on a form, serializes and returns form data.
*/
serialize(): string;
/**
* siblings
* Returns a collection of sibling elements.
*/
siblings(): Cash;
/**
* text
* Returns the inner text of the first element in the collection, sets the text if textContent is provided.
*/
text(): string;
text(content?: string): Cash;
/**
* toggleClass
* Adds or removes className from collection elements based on if the element already has the class.
* Accepts space-separated classNames for toggling multiple classes, and an optional force boolean to ensure classes are added (true) or removed (false).
*/
toggleClass(c: string, state?: boolean): Cash;
/**
* trigger
* Triggers supplied event on elements in collection. Data can be passed along as the second parameter.
*/
trigger(eventName: string, data?: any): Cash;
/**
* val
* Returns an inputs value. If value is supplied, sets all inputs in collection's value to the value argument.
*/
val(): any;
val(value?: string): Cash;
/**
* width
* Returns the width of the element.
*/
width(): number;
}
declare module "cash" {
export = CashStatic;
}
declare var cash: CashStatic;
@@ -6,6 +6,6 @@ import * as util from 'util';
var client = new cassandra.Client({ contactPoints: ['h1', 'h2'], keyspace: 'ks1'});
var query = 'SELECT email, last_name FROM user_profiles WHERE key=?';
client.execute(query, ['guy'], {}, function(err, result) {
console.log('got user profile with email ' + result.rows[0].get("email"));
client.execute(query, ['guy'], function(err: any, result: any) {
console.log('got user profile with email ' + result.rows[0].email);
});
+1 -2
View File
@@ -134,7 +134,7 @@ export namespace types {
var LocalTime: LocalTimeStatic;
var Long: _Long;
var ResultSet: ResultSetStatic;
var ResultStream: ResultStreamStatic;
// var ResultStream: ResultStreamStatic;
var Row: RowStatic;
var TimeUuid: TimeUuidStatic;
var Tuple: TupleStatic;
@@ -365,7 +365,6 @@ export namespace types {
buffer: Buffer;
paused: boolean;
_read(): void;
_valve(readNext: Function): void;
add(chunk: Buffer): void;
}
+8 -6
View File
@@ -345,6 +345,7 @@ interface ChartXAxe {
stacked?: boolean;
categoryPercentage?: number;
barPercentage?: number;
barThickness?: number;
gridLines?: GridLineOptions;
position?: string;
ticks?: TickOptions;
@@ -379,7 +380,7 @@ interface TimeScale extends ChartScales {
parser?: string | ((arg: any) => any);
round?: string;
tooltipFormat?: string;
unit?: TimeUnit;
unit?: string | TimeUnit;
unitStepSize?: number;
}
@@ -390,11 +391,12 @@ interface RadialLinearScale {
ticks?: TickOptions;
}
declare var Chart: {
new (context: CanvasRenderingContext2D, options: ChartConfiguration): {};
declare class Chart {
constructor (context: CanvasRenderingContext2D, options: ChartConfiguration);
config: ChartConfiguration;
destroy: () => {};
update: (duration: any, lazy: any) => {};
render: (duration: any, lazy: any) => {};
update: (duration?: any, lazy?: any) => {};
render: (duration?: any, lazy?: any) => {};
stop: () => {};
resize: () => {};
clear: () => {};
@@ -407,4 +409,4 @@ declare var Chart: {
defaults: {
global: ChartOptions;
}
};
}
+216
View File
@@ -0,0 +1,216 @@
// Type definitions for cheap-ruler 2.4.1
// Project: https://github.com/mapbox/cheap-ruler
// Definitions by: Denis Carriere <https://github.com/DenisCarriere>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "cheap-ruler" {
type BBox = [number, number, number, number] | number[]
type Point = [number, number] | number[]
type Line = Array<Point>
type Points = Array<Point>
type Polygon = Array<Array<Point>>
interface TemplateUnits {
kilometers: number
miles: number
nauticalmiles: number
meters: number
metres: number
yards: number
feet: number
inches: number
}
interface InterfacePointOnLine {
point: Point
index: number
t: number
}
class CheapRuler {
/**
* Given two points of the form [longitude, latitude], returns the distance.
*
* @param {Point} a point [longitude, latitude]
* @param {Point} b point [longitude, latitude]
* @returns {number} distance
* @example
* var distance = ruler.distance([30.5, 50.5], [30.51, 50.49]);
* //=distance
*/
distance(a: Point, b: Point): number;
/**
* Returns the bearing between two points in angles.
*
* @param {Point} a point [longitude, latitude]
* @param {Point} b point [longitude, latitude]
* @returns {number} bearing
* @example
* var bearing = ruler.bearing([30.5, 50.5], [30.51, 50.49]);
* //=bearing
*/
bearing(a: Point, b: Point): number;
/**
* Returns a new point given distance and bearing from the starting point.
*
* @param {Point} p point [longitude, latitude]
* @param {number} dist distance
* @param {number} bearing
* @returns {Point} point [longitude, latitude]
* @example
* var point = ruler.destination([30.5, 50.5], 0.1, 90);
* //=point
*/
destination(p: Point, dist: number, bearing: number): Point;
/**
* Given a line (an array of points), returns the total line distance.
*
* @param {Points} points [longitude, latitude]
* @returns {number} total line distance
* @example
* var length = ruler.lineDistance([
* [-67.031, 50.458], [-67.031, 50.534],
* [-66.929, 50.534], [-66.929, 50.458]
* ]);
* //=length
*/
lineDistance(points: Points): number;
/**
* Given a polygon (an array of rings, where each ring is an array of points), returns the area.
*
* @param {Polygon} polygon
* @returns {number} area value in the specified units (square kilometers by default)
* @example
* var area = ruler.area([[
* [-67.031, 50.458], [-67.031, 50.534], [-66.929, 50.534],
* [-66.929, 50.458], [-67.031, 50.458]
* ]]);
* //=area
*/
area(polygon: Polygon): number;
/**
* Returns the point at a specified distance along the line.
*
* @param {Line} line
* @param {number} dist distance
* @returns {Point} point [longitude, latitude]
* @example
* var point = ruler.along(line, 2.5);
* //=point
*/
along(line: Line, dist: number): Point
/**
* Returns an object of the form {point, index} where point is closest point on the line from the given point, and index is the start index of the segment with the closest point.
*
* @pointOnLine
* @param {Line} line
* @param {Point} p point [longitude, latitude]
* @returns {Object} {point, index}
* @example
* var point = ruler.pointOnLine(line, [-67.04, 50.5]).point;
* //=point
*/
pointOnLine(line: Line, p: Point): InterfacePointOnLine
/**
* Returns a part of the given line between the start and the stop points (or their closest points on the line).
*
* @param {Point} start point [longitude, latitude]
* @param {Point} stop point [longitude, latitude]
* @param {Line} line
* @returns {Line} line part of a line
* @example
* var line2 = ruler.lineSlice([-67.04, 50.5], [-67.05, 50.56], line1);
* //=line2
*/
lineSlice(start: Point, stop: Point, line: Line): Line
/**
* Returns a part of the given line between the start and the stop points indicated by distance along the line.
*
* @param {number} start distance
* @param {number} stop distance
* @param {Line} line
* @returns {Line} line part of a line
* @example
* var line2 = ruler.lineSliceAlong(10, 20, line1);
* //=line2
*/
lineSliceAlong(start: number, stop: number, line: Line): Line
/**
* Given a point, returns a bounding box object ([w, s, e, n]) created from the given point buffered by a given distance.
*
* @param {Point} p point [longitude, latitude]
* @param {number} buffer
* @returns {BBox} box object ([w, s, e, n])
* @example
* var bbox = ruler.bufferPoint([30.5, 50.5], 0.01);
* //=bbox
*/
bufferPoint(p: Point, buffer: number): BBox
/**
* Given a bounding box, returns the box buffered by a given distance.
*
* @param {BBox} box object ([w, s, e, n])
* @param {number} buffer
* @returns {BBox} box object ([w, s, e, n])
* @example
* var bbox = ruler.bufferBBox([30.5, 50.5, 31, 51], 0.2);
* //=bbox
*/
bufferBBox(bbox: BBox, buffer: number): BBox
/**
* Returns true if the given point is inside in the given bounding box, otherwise false.
*
* @param {Point} p point [longitude, latitude]
* @param {Point} box object ([w, s, e, n])
* @returns {boolean}
* @example
* var inside = ruler.insideBBox([30.5, 50.5], [30, 50, 31, 51]);
* //=inside
*/
insideBBox(p: Point, bbox: BBox): boolean
}
/**
* A collection of very fast approximations to common geodesic measurements. Useful for performance-sensitive code that measures things on a city scale.
*
* @param {number} lat latitude
* @param {string} [units='kilometers']
* @returns {CheapRuler}
* @example
* var ruler = cheapRuler(35.05, 'miles');
* //=ruler
*/
function cheapRuler(lat: number, units?: string): CheapRuler;
namespace cheapRuler {
/**
* Multipliers for converting between units.
*
* @example
* // convert 50 meters to yards
* 50 * cheapRuler.units.yards / cheapRuler.units.meters;
*/
const units: TemplateUnits
/**
* Creates a ruler object from tile coordinates (y and z). Convenient in tile-reduce scripts.
*
* @param {number} y
* @param {number} z
* @param {string} [units='kilometers']
* @returns {CheapRuler}
* @example
* var ruler = cheapRuler.fromTile(1567, 12);
* //=ruler
*/
function fromTile(y: number, z: number, units?: string): CheapRuler;
}
export = cheapRuler
}
+21
View File
@@ -0,0 +1,21 @@
/// <reference path="chunked-dc.d.ts" />
// Chunker
let chunker = new Chunker(1337, Uint8Array.of(1,2,3), 2);
for (let chunk of chunker) {
// Do smoething with chunk
}
while (chunker.hasNext) {
let chunk = chunker.next().value;
}
// Unchunker
let unchunker = new Unchunker();
unchunker.onMessage = (message: Uint8Array, context: any[]) => {
// Do something with the received message
};
let chunk = Uint8Array.of(1,2).buffer;
unchunker.add(chunk);
unchunker.gc(1024);
+55
View File
@@ -0,0 +1,55 @@
// Type definitions for chunked-dc v0.1.2
// Project: https://github.com/saltyrtc/chunked-dc-js
// Definitions by: Danilo Bargen <https://github.com/dbrgn/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// Interfaces
declare namespace chunkedDc {
/** common.ts **/
interface CommonStatic {
HEADER_LENGTH: number;
}
/** chunker.ts **/
interface Chunker extends IterableIterator<Uint8Array> {
hasNext: boolean;
next(): IteratorResult<Uint8Array>;
[Symbol.iterator](): IterableIterator<Uint8Array>;
}
interface ChunkerStatic {
new(id: number, message: Uint8Array, chunkSize: number): Chunker
}
/** unchunker.ts **/
type MessageListener = (message: Uint8Array, context?: any) => void;
interface Unchunker {
onMessage: MessageListener;
add(chunk: ArrayBuffer, context?: any): void;
gc(maxAge: number): number;
}
interface UnchunkerStatic {
new(): Unchunker
}
/** main.ts **/
interface Standalone {
Chunker: ChunkerStatic,
Unchunker: UnchunkerStatic,
}
}
// Entry point for the packed ES5 version:
declare var chunkedDc: chunkedDc.Standalone;
// Entry point for the ES2015 version:
declare var Chunker: chunkedDc.ChunkerStatic;
declare var Unchunker: chunkedDc.UnchunkerStatic;
+1
View File
@@ -0,0 +1 @@
--target es2015 --noImplicitAny
+44
View File
@@ -37,6 +37,23 @@ function test_CKEDITOR() {
CKEDITOR.replaceAll((textarea, config) => false);
}
function test_config() {
var config1: CKEDITOR.config = {
toolbar: 'basic',
};
var config2: CKEDITOR.config = {
toolbar: [
[ 'mode', 'document', 'doctools' ],
[ 'clipboard', 'undo' ],
'/',
[ 'find', 'selection', 'spellchecker' ],
[ 'basicstyles', 'cleanup' ],
'/',
[ 'list', 'indent', 'blocks', 'align', 'bidi' ],
],
};
}
function test_dom_comment() {
var type = CKEDITOR.NODE_COMMENT;
var nativeNode = document.createComment('Example');
@@ -319,3 +336,30 @@ function test_focusManager() {
var object: CKEDITOR.dom.domObject = focusManager.currentActive;
var bool: boolean = focusManager.hasFocus;
}
function test_basicWriter() {
var writer = new CKEDITOR.htmlParser.basicWriter();
writer.openTag('p', {});
writer.attribute('class', 'MyClass');
writer.openTagClose('p', false);
writer.text('Hello');
writer.closeTag('p');
alert(writer.getHtml(true)); // '<p class="MyClass">Hello</p>'
}
function test_htmlWriter() {
var writer = new CKEDITOR.htmlWriter();
writer.openTag('p', {});
writer.attribute('class', 'MyClass');
writer.openTagClose('p', false);
writer.text('Hello');
writer.closeTag('p');
alert(writer.getHtml(true)); // '<p class="MyClass">Hello</p>'
writer.indentationChars = '\t';
writer.lineBreakChars = '\r\n';
writer.selfClosingEnd = '>';
writer.indentation();
writer.lineBreak();
writer.setRules('img', {breakBeforeOpen: true, breakAfterOpen: true});
}
+21 -1
View File
@@ -807,7 +807,7 @@ declare namespace CKEDITOR {
templates_files?: Object;
templates_replaceContent?: boolean;
title?: string | boolean;
toolbar?: string | (string[])[];
toolbar?: string | (string | string[])[];
toolbarCanCollapse?: boolean;
toolbarGroupCycling?: boolean;
toolbarGroups?: toolbarGroups[];
@@ -1270,6 +1270,16 @@ declare namespace CKEDITOR {
toHtml(data: string, fixForBody?: string): void;
}
class htmlDataProcessor {
dataFilter: htmlParser.filter;
htmlFilter: htmlParser.filter;
writer: htmlParser.basicWriter;
constructor(editor: editor);
toDataFormat(html: string, options?: Object): string;
toHtml(data: string, options?: Object): string;
}
class event {
constructor();
@@ -1803,6 +1813,16 @@ declare namespace CKEDITOR {
}
class htmlWriter extends htmlParser.basicWriter {
indentationChars: string;
lineBreakChars: string;
selfClosingEnd: string;
indentation(): void;
lineBreak(): void;
setRules(tagName: string, rules: Object): void;
}
namespace tools {
var callFunction: Function;
+6
View File
@@ -0,0 +1,6 @@
/// <reference path="clipboard-js.d.ts" />
clipboard.copy("Hello World");
clipboard.copy(document.body).then(() => console.log("success"));
clipboard.paste().then(val => console.log(val));
+18
View File
@@ -0,0 +1,18 @@
// Type definitions for clipboard-js 0.3.1
// Project: https://github.com/lgarron/clipboard.js
// Definitions by: Mark Wong Siang Kai <https://github.com/markwongsk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace clipboard {
interface IClipboardJsStatic {
copy(val: string | Element): Promise<void>;
paste(): Promise<string>;
}
}
declare var clipboard: clipboard.IClipboardJsStatic;
declare module 'clipboard-js' {
export = clipboard;
}
+1 -1
View File
@@ -430,7 +430,7 @@ declare namespace CodeMirror {
/** Replace the part of the document between from and to with the given string.
from and to must be {line, ch} objects. to can be left off to simply insert the string at position from. */
replaceRange(replacement: string, from: CodeMirror.Position, to: CodeMirror.Position): void;
replaceRange(replacement: string, from: CodeMirror.Position, to?: CodeMirror.Position): void;
/** Get the content of line n. */
getLine(n: number): string;
+43
View File
@@ -0,0 +1,43 @@
// Type definitions for css-modules-require-hook 4.0.3
// Project: https://github.com/css-modules/css-modules-require-hook
// Definitions by: Cedric van Putten <https://bycedric.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'css-modules-require-hook' {
interface Options {
/** Helps you to invalidate cache of all require calls. */
devMode?: boolean;
/** Attach the require hook to additional file extensions. */
extensions?: string | string[];
/** Provides possibility to exclude particular files from processing. */
ignore?: string | RegExp | ((filepath: string) => boolean);
/** In rare cases you may want to precompile styles, before they will be passed to the PostCSS pipeline. */
preprocessCss?: Function;
/** In rare cases you may want to get compiled styles in runtime, so providing this option helps. */
processCss?: Function;
/** Provides possibility to pass custom options to the LazyResult instance. */
processorOpts?: Object;
/** Camelizes exported class names. */
camelCase?: boolean;
/** Appends custom plugins to the end of the PostCSS pipeline. */
append?: any[];
/** Prepends custom plugins to the beginning of the PostCSS pipeline. */
prepend?: any[];
/** Provides the full list of PostCSS plugins to the pipeline. */
use?: any[];
/** Short alias for the postcss-modules-extract-imports plugin's createImportedName option. */
createImportedName?: Function;
/** Short alias for the postcss-modules-scope plugin's option. */
generateScopedName?: string | Function;
/** Short alias for the generic-names helper option. */
hashPrefix?: string;
/** Short alias for the postcss-modules-local-by-default plugin's option. */
mode?: string;
/** Provides absolute path to the project directory. */
rootDir?: string;
}
var requireHook: (options?: Options) => void;
export = requireHook;
}
+1 -1
View File
@@ -9,7 +9,7 @@ declare namespace cucumber {
export interface CallbackStepDefinition{
pending : () => PromiseLike<any>;
(errror?:any, pending?: string):void;
(error?:any, pending?: string):void;
}
export interface TableDefinition{
+26
View File
@@ -0,0 +1,26 @@
/// <reference path="../d3/d3.d.ts" />
/// <reference path="d3-box.d.ts" />
// Inspired by http://bl.ocks.org/mbostock/4061502
function iqr(k: number) {
return function(d: any) {
var q1 = d.quartiles[0],
q3 = d.quartiles[2],
iqr = (q3 - q1) * k;
let i = -1,
j = d.length;
while (d[++i] < q1 - iqr);
while (d[--j] > q3 + iqr);
return [i, j];
};
}
var chart = d3.box()
.whiskers(iqr(1.5))
.width(100)
.height(100);
chart.domain([1, 30]);
d3.selectAll("sth.").call(chart.duration(1000));
+31
View File
@@ -0,0 +1,31 @@
// Type definitions for d3-box
// Project: https://github.com/JacksonGariety/d3-box
// Definitions by: Linkun Chen <https://github.com/lk-chen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../d3/d3.d.ts"/>
declare namespace d3 {
export function box(): Box;
interface Box {
(sel: d3.Selection<any>): void;
width(): number;
width(x: number): Box;
height(): number;
height(x: number): Box;
tickFormat(): (n: number) => string;
tickFormat(fun: (n: number) => string): Box;
duration(): number;
duration(x: number): Box;
domain(): () => number[];
domain(x: number[]): Box;
value(): (d: any) => number;
value(x: (d: any) => number): Box;
whiskers(): (d: any[], i?: number) => number[];
whiskers(x: (d: any[], i?: number) => number[]): Box;
quartiles(): (d: any[]) => number[];
quantiles(x: (d: any[]) => number[]): Box;
}
}
+24
View File
@@ -0,0 +1,24 @@
/// <reference path="../d3/d3.d.ts" />
/// <reference path="d3.slider.d.ts" />
d3.select('#slider1').call(d3.slider());
d3.select('#slider2').call(d3.slider().value( [ 10, 25 ] ));
d3.select('#slider3').call(d3.slider().axis(true).value( [ 10, 25 ] )
.on("slide", function(evt, value) {
d3.select('#slider3textmin').text(value[ 0 ]);
d3.select('#slider3textmax').text(value[ 1 ]);
}));
d3.select('#slider4').call(d3.slider().on("slide", function(evt, value) {
d3.select('#slider4text').text(value);
}));
d3.select('#slider5').call(d3.slider().axis(true));
var axis = d3.svg.axis().orient("top").ticks(4);
d3.select('#slider6').call(d3.slider().axis(axis));
d3.select('#slider7').call(d3.slider().axis(true).min(2000).max(2100).step(5));
d3.select('#slider8').call(d3.slider().value(50).orientation("vertical"));
d3.select('#slider9').call(d3.slider().value( [10, 30] ).orientation("vertical"));
d3.select('#slider10').call(d3.slider().scale(d3.time.scale().domain([new Date(1984,1,1), new Date(2014,1,1)])).axis(d3.svg.axis()));
d3.select('#slider11').call(d3.slider().scale(d3.time.scale().domain([new Date(1984,1,1), new Date(2014,1,1)])).axis(d3.svg.axis()).snap(true).value(new Date(2000,1,1)));
let essai = d3.slider().scale(d3.scale.ordinal().domain(["Gecko", "Webkit", "Blink", "Trident"]).rangePoints([0, 1], 0.5)).axis(d3.svg.axis()).snap(true).value("Gecko");
d3.select('#slider12').call(essai);
+35
View File
@@ -0,0 +1,35 @@
// Type definitions for d3-slider
// Project: https://github.com/MasterMaps/d3-slider
// Definitions by: Linkun Chen <https://github.com/lk-chen>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../d3/d3.d.ts"/>
declare namespace d3 {
export function slider(): Slider;
interface Slider {
(sel: d3.Selection<any>): void;
min(): number;
min(val: number): Slider;
max(): number;
max(val: number): Slider;
step(): number;
step(val: number): Slider;
animate(): boolean | number;
animate(val: boolean | number): Slider;
orientation(): string;
orientation(val: string): Slider;
axis(): boolean | d3.svg.Axis;
axis(val: boolean | d3.svg.Axis): Slider;
margin(): number;
margin(val: number): Slider;
value(): any;
value(val: any): Slider;
snap(): boolean;
snap(val: boolean): Slider;
scale(): any;
scale(val: any): Slider;
on(evt: ("slide" | "slideend"), callback: (evt: any, val: any) => void): Slider;
}
}
+77
View File
@@ -0,0 +1,77 @@
// Type definitions for dateformat v1.0.12
// Project: https://github.com/felixge/node-dateformat
// Definitions by: Kombu <https://github.com/aicest>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* dateFormat.masks
*
* Predefined Formats
*
* https://github.com/felixge/node-dateformat/blob/master/lib/dateformat.js#L107
*/
interface DateFormatMasks {
default: string;
shortDate: string;
mediumDate: string;
longDate: string;
fullDate: string;
shortTime: string;
mediumTime: string;
longTime: string;
isoDate: string;
isoTime: string;
isoDateTime: string;
isoUtcDateTime: string;
expiresHeaderFormat: string;
[key: string]: string;
}
/**
* dateFormat.i18n
*
* Internationalization strings
*
* Example:
*
* ```
* dateFormat.i18n = {
* dayNames: [
* 'Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat',
* 'Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'
* ],
* monthNames: [
* 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec',
* 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'
* ]
* }
* ```
*
* https://github.com/felixge/node-dateformat/blob/master/lib/dateformat.js#L124
*/
interface DateFormatI18n {
dayNames: string[];
monthNames: string[];
}
/**
* dateFormat()
*
* Accepts a date, a mask, or a date and a mask.
* Returns a formatted version of the given date.
* The date defaults to the current date/time.
* The mask defaults to dateFormat.masks.default.
*
* https://github.com/felixge/node-dateformat/blob/master/lib/dateformat.js#L18
*/
interface DateFormatStatic {
(date?: Date | string | number, mask?: string, utc?: boolean, gmt?: boolean): string;
(mask?: string, utc?: boolean, gmt?: boolean): string;
masks: DateFormatMasks;
i18n: DateFormatI18n;
}
declare module 'dateformat' {
const dateFormat: DateFormatStatic;
export = dateFormat;
}
+10
View File
@@ -0,0 +1,10 @@
// Type definitions for defaults 1.0.3
// Project: https://github.com/tmpvar/defaults/
// Definitions by: Ibtihel CHNAB <https://github.com/IbtihelCHNAB/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function defaults(options: any, defaultOptions: any): any;
declare module "defaults" {
export = defaults;
}
+15
View File
@@ -53,6 +53,21 @@ declare namespace createjs {
clone(): Bitmap;
}
export class ScaleBitmap extends DisplayObject {
constructor(imageOrUrl: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement | Object | string, scale9Grid: Rectangle);
// properties
image: HTMLImageElement | HTMLCanvasElement | HTMLVideoElement;
sourceRect: Rectangle;
drawWidth: number;
drawHeight: number;
scale9Grid: Rectangle;
snapToPixel: boolean;
// methods
setDrawSize (newWidth: number, newHeight: number): void;
clone(): ScaleBitmap;
}
export class BitmapText extends DisplayObject {
constructor(text?:string, spriteSheet?:SpriteSheet);
+56236
View File
File diff suppressed because it is too large Load Diff
+57
View File
@@ -0,0 +1,57 @@
/// <reference path="./ejson.d.ts" />
import {
clone as importedClone,
parse as importedParse,
stringify as importedStringify,
toJSONValue as importedToJSONValue,
fromJSONValue as importedFromJSONValue,
isBinary as importedIsBinary,
newBinary as importedNewBinary,
equals as importedEquals
} from "ejson";
function testImportedClone() {
var obj: Object = {
a: "a"
};
var retval: Object = importedClone(obj);
var str: string = "as";
var retval2: string = importedClone(str);
}
function testParse() {
var str: string = '{a:"a"}';
importedParse(str);
}
function testStringify() {
var obj: any = {a:"a"};
var retval: string = importedStringify(obj);
}
function testToJSONValue() {
var obj: any = {a:"a"};
var retval: string = importedToJSONValue(obj);
}
function testFromJSONValue() {
var str: string = '{a:"a"}';
importedFromJSONValue(str);
}
function testIsBinary() {
var val: any = 'sasda';
var retval: boolean = importedIsBinary(val);
}
function testNewBinary() {
var retval: Uint8Array = importedNewBinary(3);
}
function testEquals() {
var a: any;
var b: any;
var retval: boolean = importedEquals(a,b);
}
+26
View File
@@ -0,0 +1,26 @@
// Type definitions for ejson v2.1.2
// Project: https://www.npmjs.com/package/ejson
// Definitions by: Shantanu Bhadoria <https://github.com/shantanubhadoria>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module "ejson" {
interface StringifyOptions {
canonical: boolean;
indent: boolean|number|string;
}
interface CloneOptions {
keyOrderSensitive: boolean;
}
function clone<T>(obj: T): T;
function parse(str: string): any;
function stringify(obj: any, options?: StringifyOptions): string;
function toJSONValue(obj: any): string;
function fromJSONValue(obj: string): any;
function isBinary(value: any): boolean;
function newBinary(len: number): Uint8Array;
function equals(a: any, b: any, options?: CloneOptions): boolean;
}
-7
View File
@@ -1,7 +0,0 @@
/// <reference types="node" />
import electron = require('electron-prebuilt');
import child_process = require('child_process');
child_process.spawn(electron);
+4 -6
View File
@@ -1,10 +1,8 @@
// Type definitions for electron-prebuilt 0.30.1
// Project: https://github.com/mafintosh/electron-prebuilt
// Type definitions for electron 1.3.3
// Project: https://github.com/electron-userland/electron-prebuilt
// Definitions by: rhysd <https://github.com/rhysd>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'electron-prebuilt' {
var electron: string;
export = electron;
}
/// <reference path="../electron/electron.d.ts" />
// this file will be removed.
+10
View File
@@ -0,0 +1,10 @@
// Type definitions for electron 1.3.3
// Project: https://github.com/electron-userland/electron-prebuilt
// Definitions by: rhysd <https://github.com/rhysd>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module 'electron' {
var electron: string;
export = electron;
}
+10
View File
@@ -303,6 +303,10 @@ if (app.isAccessibilitySupportEnabled()) {
}
app.setLoginItemSettings({openAtLogin: true, openAsHidden: false});
console.log(app.getLoginItemSettings().wasOpenedAtLogin);
app.setAboutPanelOptions({
applicationName: 'Test',
version: '1.2.3'
});
var window = new BrowserWindow();
window.setProgressBar(0.5);
@@ -359,6 +363,12 @@ if (process.platform !== 'win32' || systemPreferences.isAeroGlassEnabled()) {
browserOptions.frame = false;
}
if (process.platform === 'win32') {
systemPreferences.on('color-changed', () => { console.log('color changed'); });
systemPreferences.on('inverted-color-scheme-changed', (_, inverted) => console.log(inverted ? 'inverted' : 'not inverted'));
console.log('Color for menu is', systemPreferences.getColor('menu'));
}
// Create the window.
var win = new BrowserWindow(browserOptions);
+3 -3
View File
@@ -26,7 +26,7 @@ ipcRenderer.send('asynchronous-message', 'ping');
// remote
// https://github.com/atom/electron/blob/master/docs/api/remote.md
var BrowserWindow: typeof Electron.BrowserWindow = remote.require('browser-window');
var BrowserWindow = remote.BrowserWindow;
var win = new BrowserWindow({ width: 800, height: 600 });
win.loadURL('https://github.com');
@@ -167,7 +167,7 @@ holder.ondrop = function (e) {
// nativeImage
// https://github.com/atom/electron/blob/master/docs/api/native-image.md
var Tray: Electron.Tray = remote.require('Tray');
var Tray = remote.Tray;
var appIcon2 = new Tray('/Users/somebody/images/icon.png');
var window2 = new BrowserWindow({ icon: '/Users/somebody/images/window.png' });
var image = clipboard.readImage();
@@ -187,7 +187,7 @@ process.once('loaded', function() {
// screen
// https://github.com/atom/electron/blob/master/docs/api/screen.md
var app: Electron.App = remote.require('app');
var app = remote.app;
var mainWindow: Electron.BrowserWindow = null;
+5765
View File
File diff suppressed because it is too large Load Diff
+132 -30
View File
@@ -1,4 +1,4 @@
// Type definitions for Electron v1.4.1
// Type definitions for Electron v1.4.2
// Project: http://electron.atom.io/
// Definitions by: jedmao <https://github.com/jedmao/>, rhysd <https://rhysd.github.io>, Milan Burda <https://github.com/miniak/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -7,22 +7,9 @@
declare namespace Electron {
class EventEmitter extends NodeJS.EventEmitter {
addListener(event: string, listener: Function): this;
on(event: string, listener: Function): this;
once(event: string, listener: Function): this;
removeListener(event: string, listener: Function): this;
removeAllListeners(event?: string): this;
setMaxListeners(n: number): this;
getMaxListeners(): number;
listeners(event: string): Function[];
emit(event: string, ...args: any[]): boolean;
listenerCount(type: string): number;
}
interface Event {
preventDefault: Function;
sender: EventEmitter;
sender: NodeJS.EventEmitter;
}
type Point = {
@@ -42,6 +29,17 @@ declare namespace Electron {
height: number;
}
interface Destroyable {
/**
* Destroys the object.
*/
destroy(): void;
/**
* @returns Whether the object is destroyed.
*/
isDestroyed(): boolean;
}
// https://github.com/electron/electron/blob/master/docs/api/app.md
/**
@@ -425,6 +423,13 @@ declare namespace Electron {
* Note: This API is only available on macOS and Windows.
*/
setLoginItemSettings(settings: LoginItemSettings): void;
/**
* Set the about panel options. This will override the values defined in the app's .plist file.
* See the Apple docs for more details.
*
* Note: This API is only available on macOS.
*/
setAboutPanelOptions(options: AboutPanelOptions): void;
commandLine: CommandLine;
/**
* Note: This API is only available on macOS.
@@ -686,6 +691,29 @@ declare namespace Electron {
restoreState?: boolean;
}
interface AboutPanelOptions {
/**
* The app's name.
*/
applicationName?: string;
/**
* The app's version.
*/
applicationVersion?: string;
/**
* Copyright information.
*/
copyright?: string;
/**
* Credit information.
*/
credits?: string;
/**
* The app's build version number.
*/
version?: string;
}
// https://github.com/electron/electron/blob/master/docs/api/auto-updater.md
/**
@@ -740,7 +768,7 @@ declare namespace Electron {
* The BrowserWindow class gives you ability to create a browser window.
* You can also create a window without chrome by using Frameless Window API.
*/
class BrowserWindow extends EventEmitter {
class BrowserWindow extends NodeJS.EventEmitter implements Destroyable {
/**
* Emitted when the document changed its title,
* calling event.preventDefault() would prevent the native windows title to change.
@@ -1104,7 +1132,7 @@ declare namespace Electron {
* setting this, the window is still a normal window, not a toolbox window
* which can not be focused on.
*/
setAlwaysOnTop(flag: boolean): void;
setAlwaysOnTop(flag: boolean, level?: WindowLevel): void;
/**
* @returns Whether the window is always on top of other windows.
*/
@@ -1357,8 +1385,8 @@ declare namespace Electron {
getChildWindows(): BrowserWindow[];
}
type WindowLevel = 'normal' | 'floating' | 'torn-off-menu' | 'modal-panel' | 'main-menu' | 'status' | 'pop-up-menu' | 'screen-saver' | 'dock';
type SwipeDirection = 'up' | 'right' | 'down' | 'left';
type ThumbarButtonFlags = 'enabled' | 'disabled' | 'dismissonclick' | 'nobackground' | 'hidden' | 'noninteractive';
interface ThumbarButton {
@@ -1538,6 +1566,11 @@ declare namespace Electron {
* Default: false.
*/
offscreen?: boolean;
/**
* Whether to enable Chromium OS-level sandbox.
* Default: false.
*/
sandbox?: boolean;
}
interface BrowserWindowOptions {
@@ -2532,7 +2565,7 @@ declare namespace Electron {
*
* Each menu consists of multiple menu items, and each menu item can have a submenu.
*/
class Menu extends EventEmitter {
class Menu extends NodeJS.EventEmitter {
/**
* Creates a new menu.
*/
@@ -2627,7 +2660,7 @@ declare namespace Electron {
*/
getBitmap(): Buffer;
/**
* @returns string The data URL of the image.
* @returns The data URL of the image.
*/
toDataURL(): string;
/**
@@ -2637,11 +2670,11 @@ declare namespace Electron {
*/
getNativeHandle(): Buffer;
/**
* @returns boolean Whether the image is empty.
* @returns Whether the image is empty.
*/
isEmpty(): boolean;
/**
* @returns {} The size of the image.
* @returns The size of the image.
*/
getSize(): Size;
/**
@@ -2689,7 +2722,7 @@ declare namespace Electron {
interface PowerSaveBlocker {
/**
* Starts preventing the system from entering lower-power mode.
* @returns an integer identifying the power save blocker.
* @returns The blocker ID that is assigned to this power blocker.
* Note: prevent-display-sleep has higher has precedence over prevent-app-suspension.
*/
start(type: 'prevent-app-suspension' | 'prevent-display-sleep'): number;
@@ -2700,7 +2733,7 @@ declare namespace Electron {
stop(id: number): void;
/**
* @param id The power save blocker id returned by powerSaveBlocker.start.
* @returns a boolean whether the corresponding powerSaveBlocker has started.
* @returns Whether the corresponding powerSaveBlocker has started.
*/
isStarted(id: number): boolean;
}
@@ -2940,7 +2973,7 @@ declare namespace Electron {
* You can also access the session of existing pages by using
* the session property of webContents which is a property of BrowserWindow.
*/
class Session extends EventEmitter {
class Session extends NodeJS.EventEmitter {
/**
* @returns a new Session instance from partition string.
*/
@@ -3136,6 +3169,11 @@ declare namespace Electron {
}
interface Cookie {
/**
* Emitted when a cookie is changed because it was added, edited, removed, or expired.
*/
on(event: 'changed', listener: (event: Event, cookie: Cookie, cause: CookieChangedCause) => void): this;
on(event: string, listener: Function): this;
/**
* The name of the cookie.
*/
@@ -3175,6 +3213,8 @@ declare namespace Electron {
expirationDate?: number;
}
type CookieChangedCause = 'explicit' | 'overwrite' | 'expired' | 'evicted' | 'expired-overwrite';
interface CookieDetails {
/**
* The URL associated with the cookie.
@@ -3515,6 +3555,38 @@ declare namespace Electron {
// https://github.com/electron/electron/blob/master/docs/api/system-preferences.md
type SystemColor =
'3d-dark-shadow' | // Dark shadow for three-dimensional display elements.
'3d-face' | // Face color for three-dimensional display elements and for dialog box backgrounds.
'3d-highlight' | // Highlight color for three-dimensional display elements.
'3d-light' | // Light color for three-dimensional display elements.
'3d-shadow' | // Shadow color for three-dimensional display elements.
'active-border' | // Active window border.
'active-caption' | // Active window title bar. Specifies the left side color in the color gradient of an active window's title bar if the gradient effect is enabled.
'active-caption-gradient' | // Right side color in the color gradient of an active window's title bar.
'app-workspace' | // Background color of multiple document interface (MDI) applications.
'button-text' | // Text on push buttons.
'caption-text' | // Text in caption, size box, and scroll bar arrow box.
'desktop' | // Desktop background color.
'disabled-text' | // Grayed (disabled) text.
'highlight' | // Item(s) selected in a control.
'highlight-text' | // Text of item(s) selected in a control.
'hotlight' | // Color for a hyperlink or hot-tracked item.
'inactive-border' | // Inactive window border.
'inactive-caption' | // Inactive window caption. Specifies the left side color in the color gradient of an inactive window's title bar if the gradient effect is enabled.
'inactive-caption-gradient' | // Right side color in the color gradient of an inactive window's title bar.
'inactive-caption-text' | // Color of text in an inactive caption.
'info-background' | // Background color for tooltip controls.
'info-text' | // Text color for tooltip controls.
'menu' | // Menu background.
'menu-highlight' | // The color used to highlight menu items when the menu appears as a flat menu.
'menubar' | // The background color for the menu bar when menus appear as flat menus.
'menu-text' | // Text in menus.
'scrollbar' | // Scroll bar gray area.
'window' | // Window background.
'window-frame' | // Window frame.
'window-text'; // Text in windows.
/**
* Get system preferences.
*/
@@ -3523,15 +3595,29 @@ declare namespace Electron {
* Note: This is only implemented on Windows.
*/
on(event: 'accent-color-changed', listener: (event: Event, newColor: string) => void): this;
/**
* Note: This is only implemented on Windows.
*/
on(event: 'color-changed', listener: (event: Event) => void): this;
/**
* Note: This is only implemented on Windows.
*/
on(event: 'inverted-color-scheme-changed', listener: (
event: Event,
/**
* @param invertedColorScheme true if an inverted color scheme, such as a high contrast theme, is being used, false otherwise.
*/
invertedColorScheme: boolean
) => void): this;
on(event: string, listener: Function): this;
/**
* @returns If the system is in Dark Mode.
* @returns Whether the system is in Dark Mode.
*
* Note: This is only implemented on macOS.
*/
isDarkMode(): boolean;
/**
* @returns If the Swipe between pages setting is on.
* @returns Whether the Swipe between pages setting is on.
*
* Note: This is only implemented on macOS.
*/
@@ -3589,6 +3675,18 @@ declare namespace Electron {
* Note: This is only implemented on Windows.
*/
getAccentColor(): string;
/**
* @returns true if an inverted color scheme, such as a high contrast theme, is active, false otherwise.
*
* Note: This is only implemented on Windows.
*/
isInvertedColorScheme(): boolean;
/**
* @returns The system color setting in RGB hexadecimal form (#ABCDEF). See the Windows docs for more details.
*
* Note: This is only implemented on Windows.
*/
getColor(color: SystemColor): string;
}
// https://github.com/electron/electron/blob/master/docs/api/tray.md
@@ -3596,7 +3694,7 @@ declare namespace Electron {
/**
* A Tray represents an icon in an operating system's notification area.
*/
interface Tray extends NodeJS.EventEmitter {
class Tray extends NodeJS.EventEmitter implements Destroyable {
/**
* Emitted when the tray icon is clicked.
* Note: The bounds payload is only implemented on macOS and Windows.
@@ -3661,7 +3759,7 @@ declare namespace Electron {
/**
* Creates a new tray icon associated with the image.
*/
new(image: NativeImage|string): Tray;
constructor(image: NativeImage|string);
/**
* Destroys the tray icon immediately.
*/
@@ -3712,6 +3810,10 @@ declare namespace Electron {
* @returns The bounds of this tray icon.
*/
getBounds(): Rectangle;
/**
* @returns Whether the tray icon is destroyed.
*/
isDestroyed(): boolean;
}
interface Modifiers {
@@ -5469,7 +5571,7 @@ declare namespace Electron {
screen: Electron.Screen;
session: typeof Electron.Session;
systemPreferences: Electron.SystemPreferences;
Tray: Electron.Tray;
Tray: typeof Electron.Tray;
webContents: Electron.WebContentsStatic;
}
+14 -2
View File
@@ -93,6 +93,18 @@ namespace ShallowWrapperTest {
boolVal = shallowWrapper.containsAnyMatchingElements([<div className="foo bar"/>]);
}
function test_dive() {
interface TmpProps {
foo: any
}
interface TmpState {
bar: any
}
const diveWrapper: ShallowWrapper<TmpProps, TmpState> = shallowWrapper.dive<TmpProps, TmpState>({ context: { foobar: 'barfoo' }});
}
function test_equals() {
boolVal = shallowWrapper.equals(<div className="foo bar"/>);
}
@@ -219,11 +231,11 @@ namespace ShallowWrapperTest {
}
function test_setState() {
shallowWrapper = shallowWrapper.setState({ stateProperty: 'state' });
shallowWrapper = shallowWrapper.setState({ stateProperty: 'state' }, () => console.log('state updated'));
}
function test_setProps() {
shallowWrapper = shallowWrapper.setProps({ propsProperty: 'foo' });
shallowWrapper = shallowWrapper.setProps({ propsProperty: 'foo' }, () => console.log('props updated'));
}
function test_setContext() {
+18 -9
View File
@@ -1,6 +1,6 @@
// Type definitions for Enzyme v2.4.1
// Type definitions for Enzyme v2.5.1
// Project: https://github.com/airbnb/enzyme
// Definitions by: Marian Palkus <https://github.com/MarianPalkus>, Cap3 <http://www.cap3.de>
// Definitions by: Marian Palkus <https://github.com/MarianPalkus>, Cap3 <http://www.cap3.de>, Ivo Stratev <https://github.com/NoHomey>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
import { ReactElement, Component, StatelessComponent, ComponentClass, HTMLAttributes as ReactHTMLAttributes } from "react";
@@ -101,11 +101,11 @@ interface CommonWrapper<P, S> {
is(selector: EnzymeSelector): boolean;
/**
* Returns whether or not the current node is empty.
*/
isEmpty(): boolean;
* Returns whether or not the current node is empty.
*/
isEmpty(): boolean;
/**
/**
* Returns a new wrapper with only the nodes of the current wrapper that don't match the provided selector.
* This method is effectively the negation or inverse of filter.
* @param selector
@@ -251,8 +251,9 @@ interface CommonWrapper<P, S> {
*
* NOTE: can only be called on a wrapper instance that is also the root instance.
* @param state
* @param [callback]
*/
setState(state: S): this;
setState(state: S, callback?: () => void): this;
/**
* A method that sets the props of the root component, and re-renders. Useful for when you are wanting to test
@@ -263,9 +264,10 @@ interface CommonWrapper<P, S> {
* Returns itself.
*
* NOTE: can only be called on a wrapper instance that is also the root instance.
* @param state
* @param props
* @param [callback]
*/
setProps(props: P): this;
setProps(props: P, callback?: () => void): this;
/**
* A method that sets the context of the root component, and re-renders. Useful for when you are wanting to
@@ -423,6 +425,13 @@ export interface ShallowWrapper<P, S> extends CommonWrapper<P, S> {
childAt<P2, S2>(index: number): ShallowWrapper<P2, S2>;
/**
* Shallow render the one non-DOM child of the current wrapper, and return a wrapper around the result.
* NOTE: can only be called on wrapper of a single non-DOM component element node.
* @param [options]
*/
dive<P2, S2>(options?: ShallowRendererProps): ShallowWrapper<P2, S2>;
/**
* Returns a wrapper around all of the parents/ancestors of the wrapper. Does not include the node in the
* current wrapper. Optionally, a selector can be provided and it will filter the parents by this selector.
*
+43
View File
@@ -0,0 +1,43 @@
// Type definitions for express-mung 0.4.2
// Project: https://github.com/richardschneider/express-mung
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../express/express.d.ts"/>
/// <reference path="../node/node.d.ts"/>
declare module "express-mung" {
import { Request, Response } from "express";
import * as http from "http";
type Transform = (body: {}, request: Request, response: Response) => any;
type TransformHeader = (body: http.IncomingMessage, request: Request, response: Response) => any;
/**
* Transform the JSON body of the response.
* @param {Transform} fn A transformation function.
* @return {any} The body.
*/
export function json(fn: Transform): any;
/**
* Transform the JSON body of the response.
* @param {Transform} fn A transformation function.
* @return {any} The body.
*/
export function jsonAsync(fn: Transform): PromiseLike<any>;
/**
* Transform the HTTP headers of the response.
* @param {Transform} fn A transformation function.
* @return {any} The body.
*/
export function headers(fn: TransformHeader): any;
/**
* Transform the HTTP headers of the response.
* @param {Transform} fn A transformation function.
* @return {any} The body.
*/
export function headersAsync(fn: TransformHeader): PromiseLike<any>;
}
+34 -21
View File
@@ -94,6 +94,23 @@ declare module "express-serve-static-core" {
options: IRouterMatcher<this>;
head: IRouterMatcher<this>;
checkout: IRouterMatcher<this>;
copy: IRouterMatcher<this>;
lock: IRouterMatcher<this>;
merge: IRouterMatcher<this>;
mkactivity: IRouterMatcher<this>;
mkcol: IRouterMatcher<this>;
move: IRouterMatcher<this>;
"m-search": IRouterMatcher<this>;
notify: IRouterMatcher<this>;
purge: IRouterMatcher<this>;
report: IRouterMatcher<this>;
search: IRouterMatcher<this>;
subscribe: IRouterMatcher<this>;
trace: IRouterMatcher<this>;
unlock: IRouterMatcher<this>;
unsubscribe: IRouterMatcher<this>;
use: IRouterHandler<this> & IRouterMatcher<this>;
route(prefix: PathParams): IRoute;
@@ -114,6 +131,23 @@ declare module "express-serve-static-core" {
patch: IRouterHandler<this>;
options: IRouterHandler<this>;
head: IRouterHandler<this>;
checkout: IRouterHandler<this>;
copy: IRouterHandler<this>;
lock: IRouterHandler<this>;
merge: IRouterHandler<this>;
mkactivity: IRouterHandler<this>;
mkcol: IRouterHandler<this>;
move: IRouterHandler<this>;
"m-search": IRouterHandler<this>;
notify: IRouterHandler<this>;
purge: IRouterHandler<this>;
report: IRouterHandler<this>;
search: IRouterHandler<this>;
subscribe: IRouterHandler<this>;
trace: IRouterHandler<this>;
unlock: IRouterHandler<this>;
unsubscribe: IRouterHandler<this>
}
export interface Router extends IRouter { }
@@ -1064,27 +1098,6 @@ declare module "express-serve-static-core" {
}
interface Express extends Application {
/**
* Framework version.
*/
version: string;
/**
* Expose mime.
*/
mime: string;
(): Application;
/**
* Create an express application.
*/
createApplication(): Application;
createServer(): Application;
application: any;
request: Request;
response: Response;
+1 -1
View File
@@ -1,6 +1,6 @@
import {ServerRequest, ServerResponse} from "http";
import finalHandler from "finalhandler";
import * as finalHandler from "finalhandler";
let req: ServerRequest;
let res: ServerResponse;
+9 -7
View File
@@ -8,12 +8,14 @@
import {ServerRequest, ServerResponse} from "http";
export interface Options {
message?: boolean | ((err: any, status: number) => string);
onerror?: (err: any, req: ServerRequest, res: ServerResponse) => void;
stacktrace?: boolean;
declare function finalHandler(req: ServerRequest, res: ServerResponse, options?: finalHandler.Options): (err: any) => void;
declare namespace finalHandler {
export interface Options {
message?: boolean|((err: any, status: number) => string);
onerror?: (err: any, req: ServerRequest, res: ServerResponse) => void;
stacktrace?: boolean;
}
}
declare function finalHandler(req: ServerRequest, res: ServerResponse, options?: Options): (err: any) => void;
export default finalHandler;
export = finalHandler;
+10
View File
@@ -0,0 +1,10 @@
/// <reference path="fossil-delta.d.ts" />
import * as fossilDelta from "fossil-delta";
var origin = new Array<number>(1,2,3);
var target = new Array<number>(1,2,3,4,5);
var delta = fossilDelta.create(origin, target);
var targetApplied = fossilDelta.apply(origin, delta);
var outputSize: number = fossilDelta.outputSize(delta);
+13
View File
@@ -0,0 +1,13 @@
// Type definitions for fossil-delta 0.2.5
// Project: https://github.com/dchest/fossil-delta-js
// Definitions by: Endel Dreyer <https://github.com/endel/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
declare module "fossil-delta" {
type ByteArray = Array<number> | Uint8Array | Buffer;
export function create(origin: ByteArray, target: ByteArray): Array<number>;
export function apply(origin: ByteArray, delta: Array<number>): Array<number>;
export function outputSize(delta: Array<number>): number;
}
+7 -10
View File
@@ -8,7 +8,6 @@
/// <reference types="node" />
import * as stream from 'stream';
export * from "fs";
export declare function copy(src: string, dest: string, callback?: (err: Error) => void): void;
@@ -19,9 +18,6 @@ export declare function copySync(src: string, dest: string): void;
export declare function copySync(src: string, dest: string, filter: CopyFilter): void;
export declare function copySync(src: string, dest: string, options: CopyOptions): void;
export declare function move(src: string, dest: string, callback?: (err: Error) => void): void;
export declare function move(src: string, dest: string, options: MoveOptions, callback?: (err: Error) => void): void;
export declare function createFile(file: string, callback?: (err: Error) => void): void;
export declare function createFileSync(file: string): void;
@@ -73,8 +69,8 @@ export declare function ensureSymlinkSync(path: string): void;
export declare function emptyDir(path: string, callback?: (err: Error) => void): void;
export declare function emptyDirSync(path: string): boolean;
export interface CopyFilterFunction {
export interface CopyFilterFunction {
(src: string): boolean
}
@@ -87,10 +83,11 @@ export interface CopyOptions {
filter?: CopyFilter
recursive?: boolean
}
export interface MoveOptions {
clobber?: boolean;
limit?: number;
}
export interface MoveOptions {
clobber? : boolean;
limit?: number;
}
export interface OpenOptions {
encoding?: string;
+1 -7
View File
@@ -136,13 +136,7 @@ export interface Options extends AgendaOptions, EventDraggingResizingOptions, Dr
eventAfterAllRender?: (view: ViewObject) => void;
eventDestroy?: (event: EventObject, element: JQuery, view: ViewObject) => void;
//scheduler options
resourceAreaWidth?: number;
schedulerLicenseKey?: string;
customButtons?: any;
resourceLabelText?: any;
resourceColumns?: any;
displayEventTime?: any;
//scheduler options
}
/**
+84 -2
View File
@@ -516,9 +516,91 @@ declare namespace gapi.drive.realtime {
}
// INCOMPLETE
// Complete
// https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime#.ErrorType
export type ErrorType =
"concurrent_creation" | "invalid_compound_operation" | "invalid_json_syntax" |
"missing_property" | "not_found" | "forbidden" | "server_error" | "client_error" |
"token_refresh_required" | "invalid_element_type" | "no_write_permission" |
"fatal_network_error" | "unexpected_element";
export var ErrorType : {
// Another user created the document's initial state after
// gapi.drive.realtime.load was called but before the local
// creation was saved.
CONCURRENT_CREATION: ErrorType,
// A compound operation was still open at the end of a
// synchronous block. Compound operations must always
// be ended in the same synchronous block that they
// are started.
INVALID_COMPOUND_OPERATION: ErrorType,
// The user tried to decode a brix model that
// contained invalid json.
INVALID_JSON_SYNTAX: ErrorType,
// The user tried to decode a brix model that was
// missing a neccessary property.
MISSING_PROPERTY: ErrorType,
// The provided document ID could not be found.
NOT_FOUND: ErrorType,
// The user associated with the provided OAuth token
// is not authorized to access the provided document
// ID.
FORBIDDEN: ErrorType,
// An internal error occurred in the Drive Realtime
// API server.
SERVER_ERROR: ErrorType,
// An internal error occurred in the Drive Realtime API client.
CLIENT_ERROR: ErrorType,
// The provided OAuth token is no longer valid and
// must be refreshed.
TOKEN_REFRESH_REQUIRED: ErrorType,
// The provided JSON element does not have the
// expected type.
INVALID_ELEMENT_TYPE: ErrorType,
// The user does not have permission to edit the
// document.
NO_WRITE_PERMISSION: ErrorType,
// A network error occurred on a request to the
// Realtime API server for a request which can not be
// retried. The document may no longer be used after
// this error has occurred. This error can only be
// corrected by reloading the document.
FATAL_NETWORK_ERROR: ErrorType,
// The provided JSON element has the correct JSON type
// but does not have the correct expected Realtime
// type.
UNEXPECTED_ELEMENT: ErrorType,
};
// Complete
// https://developers.google.com/google-apps/realtime/reference/gapi.drive.realtime.Error
export class Error { }
export class Error {
constructor (type: string, message: string, isFatal: boolean);
// The type of the error that occurred.
type: ErrorType;
// A message describing the error.
message: string;
// Whether the error is fatal. Fatal errors cannot be recovered
// from and require the document to be reloaded.
isFatal: boolean;
// Returns a string representation of the error object.
toString(): string;
}
// Complete
// Opens the debugger application on the current page. The debugger shows all realtime documents that the
+1
View File
@@ -19,6 +19,7 @@ declare namespace libphonenumber {
static getInstance(): PhoneNumberUtil
parse(number: string, region: string): PhoneNumber;
isValidNumber(phoneNumber: PhoneNumber): boolean;
isPossibleNumber(phoneNumber: PhoneNumber): boolean;
isValidNumberForRegion(phoneNumber: PhoneNumber): boolean;
getRegionCodeForNumber(phoneNumber: PhoneNumber): string;
isNANPACountry(regionCode: string): boolean;
+2
View File
@@ -1797,6 +1797,8 @@ declare namespace google.maps {
toString(): string;
/** Returns a string of the form "lat,lng". We round the lat/lng values to 6 decimal places by default. */
toUrlValue(precision?: number): string;
/** Converts to JSON representation. This function is intended to be used via JSON.stringify. */
toJSON(): LatLngLiteral;
}
export type LatLngLiteral = { lat: number; lng: number }
+103 -121
View File
@@ -44,7 +44,7 @@ declare type TweenConfig = {
autoCSS?: boolean;
callbackScope?: Object;
}
//com.greensock.core
declare class Animation {
static ticker: IDispatcher;
@@ -198,109 +198,106 @@ declare class TimelineMax extends TimelineLite {
}
//com.greensock.easing
interface Back {
easeIn:Ease;
easeInOut:Ease;
easeOut:Ease;
declare class Ease {
constructor(func:Function, extraParams:any[], type:number, power:number);
public getRatio(p: number): number;
}
interface Bounce {
easeIn:Ease;
easeInOut:Ease;
easeOut:Ease;
}
interface Circ {
easeIn:Ease;
easeInOut:Ease;
easeOut:Ease;
}
interface Cubic {
easeIn:Ease;
easeInOut:Ease;
easeOut:Ease;
}
interface Ease {
getRatio(p:number):number;
}
interface EaseLookup {
find(name:string):Ease;
}
interface Elastic {
easeIn:Ease;
easeInOut:Ease;
easeOut:Ease;
}
interface Expo {
easeIn:Ease;
easeInOut:Ease;
easeOut:Ease;
}
interface Linear {
ease:Linear;
easeIn:Linear;
easeInOut:Linear;
easeNone:Linear;
easeOut:Linear;
}
interface Power0 {
easeIn:Ease;
easeInOut:Ease;
easeOut:Ease;
}
interface Power1 {
easeIn:Ease;
easeInOut:Ease;
easeOut:Ease;
}
interface Power2 {
easeIn:Ease;
easeInOut:Ease;
easeOut:Ease;
}
interface Power3 {
easeIn:Ease;
easeInOut:Ease;
easeOut:Ease;
}
interface Power4 {
easeIn:Ease;
easeInOut:Ease;
easeOut:Ease;
}
interface Quad {
easeIn:Ease;
easeInOut:Ease;
easeOut:Ease;
}
interface Quart {
easeIn:Ease;
easeInOut:Ease;
easeOut:Ease;
}
interface Quint {
easeIn:Ease;
easeInOut:Ease;
easeOut:Ease;
}
interface Sine {
easeIn:Ease;
easeInOut:Ease;
easeOut:Ease;
}
interface SlowMo {
ease:SlowMo;
new (linearRatio:number, power:number, yoyoMode:boolean):SlowMo;
config(linearRatio:number, power:number, yoyoMode:boolean):SlowMo;
getRatio(p:number):number;
declare class EaseLookup {
public static find(name: string): Ease;
}
interface SteppedEase {
config(steps:number):SteppedEase;
getRatio(p:number):number;
declare class Back extends Ease {
public static easeIn: Back;
public static easeInOut: Back;
public static easeOut: Back;
public config(overshoot: number): Elastic;
}
interface Strong {
easeIn:Ease;
easeInOut:Ease;
easeOut:Ease;
declare class Bounce extends Ease {
public static easeIn: Bounce;
public static easeInOut: Bounce;
public static easeOut: Bounce;
}
declare class Circ extends Ease {
public static easeIn: Circ;
public static easeInOut: Circ;
public static easeOut: Circ;
}
declare class Cubic extends Ease {
public static easeIn: Cubic;
public static easeInOut: Cubic;
public static easeOut: Cubic;
}
declare class Elastic extends Ease {
public static easeIn: Elastic;
public static easeInOut: Elastic;
public static easeOut: Elastic;
public config(amplitude: number, period: number): Elastic;
}
declare class Expo extends Ease {
public static easeIn: Expo;
public static easeInOut: Expo;
public static easeOut: Expo;
}
declare class Linear extends Ease {
public static ease: Linear;
public static easeIn: Linear;
public static easeInOut: Linear;
public static easeNone: Linear;
public static easeOut: Linear;
}
declare class Quad extends Ease {
public static easeIn: Quad;
public static easeInOut: Quad;
public static easeOut: Quad;
}
declare class Quart extends Ease {
public static easeIn: Quart;
public static easeInOut: Quart;
public static easeOut: Quart;
}
declare class Quint extends Ease {
public static easeIn: Quint;
public static easeInOut: Quint;
public static easeOut: Quint;
}
declare class Sine extends Ease {
public static easeIn: Sine;
public static easeInOut: Sine;
public static easeOut: Sine;
}
declare class SlowMo extends Ease {
public static ease: SlowMo;
public config(linearRatio: number, power: number, yoyoMode: boolean): SlowMo;
}
declare class SteppedEase extends Ease {
constructor(staps: number);
public config(steps: number): SteppedEase;
}
declare type RoughEaseConfig = {
clamp?: boolean;
points?: number;
randomize?: boolean;
strength?: number;
taper?: string; /* one of "in" | "out" | "both" | "none" */
template?: Ease;
}
declare class RoughEase extends Ease {
public static ease: RoughEase;
constructor(vars: RoughEaseConfig);
public config(steps: number): SteppedEase;
}
//com.greensock.plugins
@@ -335,27 +332,12 @@ interface TweenPlugin {
}
//com.greensock.easing
declare var Back:Back;
declare var Bounce:Bounce;
declare var Circ:Circ;
declare var Cubic:Cubic;
declare var Ease:Ease;
declare var EaseLookup:EaseLookup;
declare var Elastic:Elastic;
declare var Expo:Expo;
declare var Linear:Linear;
declare var Power0:Power0;
declare var Power1:Power1;
declare var Power2:Power2;
declare var Power3:Power3;
declare var Power4:Power4;
declare var Quad:Quad;
declare var Quart:Quart;
declare var Quint:Quint;
declare var Sine:Sine;
declare var SlowMo:SlowMo;
declare var SteppedEase:SteppedEase;
declare var Strong:Strong;
declare var Power0: typeof Linear;
declare var Power1: typeof Quad;
declare var Power2: typeof Cubic;
declare var Power3: typeof Quart;
declare var Power4: typeof Quint;
declare var Strong: typeof Quint;
//com.greensock.plugins
declare var BezierPlugin:BezierPlugin;
+37
View File
@@ -0,0 +1,37 @@
/// <reference path="gulp-cache.d.ts" />
/// <reference path="../gulp/gulp.d.ts" />
import * as fs from "fs";
import * as gulp from "gulp";
import * as cache from "gulp-cache";
import File = require("vinyl");
// Some gulp plugin
let jshint: any;
gulp.task('lint', function () {
gulp.src('./non/existent/path/*.js')
.pipe(cache(jshint('.jshintrc'), {
key: makeHashKey,
success: function (jshintedFile) {
return jshintedFile.jshint.success;
},
value: function (jshintedFile) {
return {
jshint: jshintedFile.jshint
};
}
}))
.pipe(jshint.reporter('default'));
});
var jsHintVersion = '2.4.1',
jshintOptions = fs.readFileSync('.jshintrc');
function makeHashKey(file: File) {
return [file.contents.toString('utf8'), jsHintVersion, jshintOptions].join('');
}
gulp.task('clear', function (done: any) {
return cache.clearAll(done);
});
+94
View File
@@ -0,0 +1,94 @@
// Type definitions for gulp-cache v0.4.5
// Project: https://github.com/jgable/gulp-cache
// Definitions by: Arun Aravind <https://github.com/aravindarun>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../node/node.d.ts" />
/// <reference path="../vinyl/vinyl.d.ts" />
/// <reference path="../gulp-util/gulp-util.d.ts" />
declare module "gulp-cache" {
import File = require("vinyl");
import { Transform } from "stream";
import { PluginError } from "gulp-util";
namespace gc {
type Predicate<T> = (arg: T) => boolean;
interface IGulpCacheOptions {
/**
* The cache instance to use for caching.
*/
fileCache?: IGulpCache;
/**
* The name of the bucket which stores the cached objects.
* Default value = 'default'
*/
name?: string,
/**
* The hash generator to use.
*/
key?: (file: File, callback?: (err: any, result: string) => void) => string | Promise<string>;
/**
* Value representing the success of a task.
*/
success?: boolean | Predicate<any>;
/**
* Content that is to be cached.
*/
value?: (result: any) => Object | Promise<Object> | string;
}
interface ICacheOptions {
/**
* Specifies the name of the directory where the cache
* is to be stored.
*/
cacheDirName: string;
}
interface IGulpCacheStatic {
/**
* Caches the result of a task.
* @param task The task whose result is to be cached.
*/
(task: NodeJS.ReadWriteStream): Transform;
/**
* Caches the result of a task.
* @param task Task whose result is to be cached.
* @param options Override values for available settings.
*/
(task: NodeJS.ReadWriteStream, options: IGulpCacheOptions): Transform;
clear(options: IGulpCacheOptions): Transform;
/**
* Represents a cache store.
*/
Cache: IGulpCache;
/**
* Purges the cache.
* @param err PluginError instance in case of a plugin error.
* If callback is not specified an exception of type
* 'PluginError' is thrown.
*/
clearAll(callback?: (err: PluginError) => void): void;
}
/**
* Represents a cach store.
*/
interface IGulpCache {
new (options: ICacheOptions): any;
}
}
const _: gc.IGulpCacheStatic;
export = _;
}
+10
View File
@@ -0,0 +1,10 @@
/// <reference path="../gulp/gulp.d.ts" />
/// <reference path="gulp-copy.d.ts" />
import * as gulp from "gulp";
import * as gulpCopy from "gulp-copy";
gulp.task("copy-files", () => {
gulp.src("*.nonexistent")
.pipe(gulpCopy("remove/target/some/non/existent/path", { prefix: 2 }));
});
+39
View File
@@ -0,0 +1,39 @@
// Type definitions for gulp-copy v0.0.2
// Project: https://github.com/klaascuvelier/gulp-copy
// Definitions by: Arun Aravind <https://github.com/aravindarun>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../through/through.d.ts" />
declare module "gulp-copy" {
import through = require("through");
/**
* Copy files to destination and expose those files as source streams for the gulp pipeline.
*
* @param outDirectory The name of the destination directory. If this directory
* does not exist, it will be created atomatically.
*/
function gulpCopy(outDirectory: string): through.ThroughStream;
/**
* Copy files to destination and expose those files as source streams for the gulp pipeline.
*
* @param outDirectory The name of the destination directory. If this directory
* does not exist, it will be created atomatically.
* @param options Override values for available settings.
*/
function gulpCopy(outDirectory: string, options: gulpCopy.GulpCopyOptions): through.ThroughStream;
namespace gulpCopy {
export interface GulpCopyOptions {
/**
* Specifies the number of parts of the path to be ignored as path prefixes.
*/
prefix: number;
}
}
export = gulpCopy;
}
+98
View File
@@ -0,0 +1,98 @@
// Type definitions for hapi-decorators v0.4.3
// Project: https://github.com/knownasilya/hapi-decorators
// Definitions by: Ken Howard <http://github.com/kenhowardpdx>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="../hapi/hapi.d.ts" />
declare module 'hapi-decorators' {
import * as hapi from 'hapi';
interface ControllerStatic {
new (): Controller;
}
export interface Controller {
baseUrl: string;
routes: () => hapi.IRouteConfiguration[];
}
export function controller(baseUrl: string): (target: ControllerStatic) => void;
interface IRouteSetup {
(target: any, key: any, descriptor: any): any;
}
interface IRouteDecorator {
(method: string, path: string): IRouteSetup;
}
interface IRouteConfig {
(path: string): IRouteSetup;
}
export const route: IRouteDecorator;
export const get: IRouteConfig;
export const post: IRouteConfig;
export const put: IRouteConfig;
// export const delete: IRouteConfig;
export const patch: IRouteConfig;
export const all: IRouteConfig;
export function config(config: hapi.IRouteAdditionalConfigurationOptions): (target: any, key: any, descriptor: any) => any;
interface IValidateConfig {
/** validation rules for incoming request headers.Values allowed:
* trueany headers allowed (no validation performed).This is the default.
falseno headers allowed (this will cause all valid HTTP requests to fail).
a Joi validation object.
a validation function using the signature function(value, options, next) where:
valuethe object containing the request headers.
optionsthe server validation options.
next(err, value)the callback function called when validation is completed.
*/
headers?: boolean | hapi.IJoi | hapi.IValidationFunction;
/** validation rules for incoming request path parameters, after matching the path against the route and extracting any parameters then stored in request.params.Values allowed:
trueany path parameters allowed (no validation performed).This is the default.
falseno path variables allowed.
a Joi validation object.
a validation function using the signature function(value, options, next) where:
valuethe object containing the path parameters.
optionsthe server validation options.
next(err, value)the callback function called when validation is completed. */
params?: boolean | hapi.IJoi | hapi.IValidationFunction;
/** validation rules for an incoming request URI query component (the key- value part of the URI between '?' and '#').The query is parsed into its individual key- value pairs (using the qs module) and stored in request.query prior to validation.Values allowed:
trueany query parameters allowed (no validation performed).This is the default.
falseno query parameters allowed.
a Joi validation object.
a validation function using the signature function(value, options, next) where:
valuethe object containing the query parameters.
optionsthe server validation options.
next(err, value)the callback function called when validation is completed. */
query?: boolean | hapi.IJoi | hapi.IValidationFunction;
/** validation rules for an incoming request payload (request body).Values allowed:
trueany payload allowed (no validation performed).This is the default.
falseno payload allowed.
a Joi validation object.
a validation function using the signature function(value, options, next) where:
valuethe object containing the payload object.
optionsthe server validation options.
next(err, value)the callback function called when validation is completed. */
payload?: boolean | hapi.IJoi | hapi.IValidationFunction;
/** an optional object with error fields copied into every validation error response. */
errorFields?: any;
/** determines how to handle invalid requests.Allowed values are:
'error'return a Bad Request (400) error response.This is the default value.
'log'log the error but continue processing the request.
'ignore'take no action.
OR a custom error handler function with the signature 'function(request, reply, source, error)` where:
requestthe request object.
replythe continuation reply interface.
sourcethe source of the invalid field (e.g. 'path', 'query', 'payload').
errorthe error object prepared for the client response (including the validation function error under error.data). */
failAction?: string | hapi.IRouteFailFunction;
/** options to pass to Joi.Useful to set global options such as stripUnknown or abortEarly (the complete list is available here: https://github.com/hapijs/joi#validatevalue-schema-options-callback ).Defaults to no options. */
options?: any;
}
export function validate(config: IValidateConfig): (target: any, key: any, descriptor: any) => any;
interface ICacheConfig {
privacy?: string;
expiresIn?: number;
expiresAt?: number;
}
export function cache(cacheConfig: ICacheConfig): (target: any, key: any, descriptor: any) => any;
export function pre(pre: {
[key: string]: any;
}): (target: any, key: any, descriptor: any) => any;
}
+43 -9
View File
@@ -73,6 +73,37 @@ export interface ICatBoxCacheOptions {
/** if true, allows multiple cache users to share the same segment (e.g. multiple methods using the same cache storage container). Default to false. */
shared?: boolean;
}
/** policy configuration for the "CatBox" module and server method options. */
export interface ICatBoxCachePolicyOptions {
/** the cache name configured in server.cache. Defaults to the default cache. */
cache?: string;
/** string segment name, used to isolate cached items within the cache partition. When called within a plugin, defaults to '!name' where 'name' is the plugin name. When called within a server method, defaults to '#name' where 'name' is the server method name. Required when called outside of a plugin. */
segment?: string;
/** if true, allows multiple cache provisions to share the same segment. Default to false. */
shared?: boolean;
/** relative expiration expressed in the number of milliseconds since the item was saved in the cache. Cannot be used together with expiresAt. */
expiresIn?: number;
/** time of day expressed in 24h notation using the 'HH:MM' format, at which point all cache records expire. Uses local time. Cannot be used together with expiresIn. */
expiresAt?: number;
/** a function used to generate a new cache item if one is not found in the cache when calling get(). The method's signature is function(id, next) where: - id - the id string or object provided to the get() method. - next - the method called when the new item is returned with the signature function(err, value, ttl) where: - err - an error condition. - value - the new value generated. - ttl - the cache ttl value in milliseconds. Set to 0 to skip storing in the cache. Defaults to the cache global policy. */
generateFunc?: Function;
/** number of milliseconds to mark an item stored in cache as stale and attempt to regenerate it when generateFunc is provided. Must be less than expiresIn. */
staleIn?: number;
/** number of milliseconds to wait before checking if an item is stale. */
staleTimeout?: number;
/** number of milliseconds to wait before returning a timeout error when the generateFunc function takes too long to return a value. When the value is eventually returned, it is stored in the cache for future requests. Required if generateFunc is present. Set to false to disable timeouts which may cause all get() requests to get stuck forever. */
generateTimeout?: number;
/** if true, an error or timeout in the generateFunc causes the stale value to be evicted from the cache. Defaults to true */
dropOnError?: boolean;
/** if false, an upstream cache read error will stop the cache.get() method from calling the generate function and will instead pass back the cache error. Defaults to true. */
generateOnReadError?: boolean;
/** if false, an upstream cache write error when calling cache.get() will be passed back with the generated value when calling. Defaults to true. */
generateIgnoreWriteError?: boolean;
/** number of milliseconds while generateFunc call is in progress for a given id, before a subsequent generateFunc call is allowed. Defaults to 0 (no blocking of concurrent generateFunc calls beyond staleTimeout). */
pendingGenerateTimeout?: number;
}
/** Any connections configuration server defaults can be included to override and customize the individual connection. */
export interface IServerConnectionOptions extends IConnectionConfigurationServerDefaults {
@@ -103,6 +134,8 @@ export interface IServerConnectionOptions extends IConnectionConfigurationServer
export interface IConnectionConfigurationServerDefaults {
/** application-specific connection configuration which can be accessed via connection.settings.app. Provides a safe place to store application configuration without potential conflicts with the framework internals. Should not be used to configure plugins which should use plugins[name]. Note the difference between connection.settings.app which is used to store configuration values and connection.app which is meant for storing run-time state. */
app?: any;
/** if false, response content encoding is disabled. Defaults to true */
compression?: boolean;
/** connection load limits configuration where: */
load?: {
/** maximum V8 heap size over which incoming requests are rejected with an HTTP Server Timeout (503) response. Defaults to 0 (no limit). */
@@ -328,11 +361,12 @@ export interface IStrictReply<T> extends IReplyMethods {
export interface ISessionHandler {
(request: Request, reply: IReply): void;
}
}
export interface IStrictSessionHandler {
export interface IStrictSessionHandler {
<T>(request: Request, reply: IStrictReply<T>): void;
}
export interface IRequestHandler<T> {
(request: Request): T;
}
@@ -496,7 +530,7 @@ export interface IRouteAdditionalConfigurationOptions {
};
/** an alternative location for the route handler option. */
handler?: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig;
handler?: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig;
/** an optional unique identifier used to look up the route using server.lookup(). */
id?: number;
/** optional arguments passed to JSON.stringify() when converting an object or error response to a string payload.Supports the following: */
@@ -895,7 +929,7 @@ export interface IRouteConfiguration {
/** - an optional domain string or an array of domain strings for limiting the route to only requests with a matching host header field.Matching is done against the hostname part of the header only (excluding the port).Defaults to all hosts.*/
vhost?: string;
/** - (required) the function called to generate the response after successful authentication and validation.The handler function is described in Route handler.If set to a string, the value is parsed the same way a prerequisite server method string shortcut is processed.Alternatively, handler can be assigned an object with a single key using the name of a registered handler type and value with the options passed to the registered handler.*/
handler?: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig;
handler?: ISessionHandler | IStrictSessionHandler | string | IRouteHandlerConfig;
/** - additional route options.*/
config?: IRouteAdditionalConfigurationOptions;
}
@@ -1106,7 +1140,7 @@ export interface IServerMethod {
generateKey - a function used to generate a unique key (for caching) from the arguments passed to the method function (the callback argument is not passed as input). The server will automatically generate a unique key if the function's arguments are all of types 'string', 'number', or 'boolean'. However if the method uses other types of arguments, a key generation function must be provided which takes the same arguments as the function and returns a unique string (or null if no key can be generated).*/
export interface IServerMethodOptions {
bind?: any;
cache?: ICatBoxCacheOptions;
cache?: ICatBoxCachePolicyOptions;
callback?: boolean;
generateKey?(args: any[]): string;
}
@@ -1873,9 +1907,9 @@ export class Server extends Events.EventEmitter {
}
}
});*/
strategy(name: string, scheme: string, mode?: boolean | string, options?: any): void;
strategy(name: string, scheme: string, mode?: boolean | string): void;
strategy(name: string, scheme: string, options?: any): void;
strategy(name: string, scheme: string, mode?: boolean | string, options?: any): void;
strategy(name: string, scheme: string, mode?: boolean | string): void;
strategy(name: string, scheme: string, options?:any): void;
/** server.auth.test(strategy, request, next)
Tests a request against an authentication strategy where:
@@ -1942,7 +1976,7 @@ export class Server extends Events.EventEmitter {
// value === { capital: 'oslo' };
});
});*/
cache(options: ICatBoxCacheOptions): void;
cache(options: ICatBoxCachePolicyOptions): void;
/** server.connection([options])
Adds an incoming server connection
+8 -1
View File
@@ -1,4 +1,4 @@
// Type definitions for hellosign-embedded v1.0.3
// Type definitions for hellosign-embedded v1.2.0
// Project: https://github.com/HelloFax/hellosign-embedded
// Definitions by: Brian Surowiec <https://github.com/xt0rted/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -155,6 +155,13 @@ declare module HelloSign {
*/
EVENT_SIGNED: string;
/**
* The signature request was declined
*
* @default signature_request_declined
*/
EVENT_DECLINED: string;
/**
* The user closed the iFrame before completing
*
+4 -4
View File
@@ -6,11 +6,11 @@
/// <reference types="highcharts" />
interface HighChartsNGConfig {
options: HighchartsOptions;
options: __Highcharts.Options;
//The below properties are watched separately for changes.
//Series object (optional) - a list of series using normal highcharts series options.
series?: HighchartsIndividualSeriesOptions[];
series?: __Highcharts.IndividualSeriesOptions[];
//Title configuration (optional)
title?: {
text?: string;
@@ -33,11 +33,11 @@ interface HighChartsNGConfig {
height?: number;
};
//function (optional) - setup some logic for the chart
func?: (chart: HighchartsChartObject) => void;
func?: (chart: __Highcharts.ChartObject) => void;
}
//Instantiated Chart
interface HighChartsNGChart extends HighChartsNGConfig {
//This is a simple way to access all the Highcharts API that is not currently managed by this directive.
getHighcharts(): HighchartsChartObject;
getHighcharts(): __Highcharts.ChartObject;
}
+1 -1
View File
@@ -5,7 +5,7 @@
/// <reference path="highcharts.d.ts" />
declare var HighchartsBoost: (H: HighchartsStatic) => HighchartsStatic;
declare var HighchartsBoost: (H: __Highcharts.Static) => __Highcharts.Static;
declare module "highcharts/modules/boost" {
export = HighchartsBoost;
+1 -1
View File
@@ -5,7 +5,7 @@
/// <reference path="highcharts.d.ts" />
declare var HighchartsExporting: (H: HighchartsStatic) => HighchartsStatic;
declare var HighchartsExporting: (H: __Highcharts.Static) => __Highcharts.Static;
declare module "highcharts/modules/exporting" {
export = HighchartsExporting;

Some files were not shown because too many files have changed in this diff Show More