This commit is contained in:
David Newell
2017-11-15 10:20:53 -05:00
218 changed files with 9828 additions and 5556 deletions
+6
View File
@@ -186,6 +186,12 @@
"sourceRepoURL": "https://github.com/loopline-systems/electron-builder",
"asOfVersion": "2.8.0"
},
{
"libraryName": "error-stack-parser",
"typingsPackageName": "error-stack-parser",
"sourceRepoURL": "https://github.com/stacktracejs/error-stack-parser",
"asOfVersion": "2.0.0"
},
{
"libraryName": "eventemitter2",
"typingsPackageName": "eventemitter2",
-55
View File
@@ -1,55 +0,0 @@
## What is it?
This is a typescript interface to be used with [angular-hotkeys](https://github.com/chieffancypants/angular-hotkeys/).
## What are declaration files?
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 these typings:
```sh
npm install --save-dev @types/angular-hotkeys
```
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).
### Other methods
These can be used by TypeScript 1.0.
* [Typings](https://github.com/typings/typings)
* ~~[NuGet](http://nuget.org/Tpackages?q=DefinitelyTyped)~~ (use preferred alternatives, nuget DT type publishing has been turned off)
* 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 to use
After installing a package you can import the definition file and begin using it as so:
```ts
import * as hotkeys from '../../node_modules/@types/angular-hotkeys'
class FooController {
static $inject = [
'hotkeys'
];
constructor(
private hotkeys: ng.hotkeys.HotkeysProvider
) { }
}
```
for a detailed explanation of the behavior of angular-hotkeys please refer to [its documentation](https://github.com/chieffancypants/angular-hotkeys/)
+64 -27
View File
@@ -1,30 +1,67 @@
var scope: ng.IScope;
var hotkeyProvider: ng.hotkeys.HotkeysProvider;
var hotkeyObj: ng.hotkeys.Hotkey;
import { HotkeysProvider, Hotkey } from 'angular-hotkeys';
import { module } from 'angular';
hotkeyProvider.add("mod+s", "saves a file", (event: Event, hotkey: ng.hotkeys.Hotkey) => {} );
hotkeyProvider.add(["mod+s"], "saves a file", (event: Event, hotkey: ng.hotkeys.Hotkey) => {} );
hotkeyProvider.add(hotkeyObj);
hotkeyProvider.bindTo(scope);
hotkeyProvider.del("mod+s");
hotkeyProvider.del(["mod+s"]);
hotkeyProvider.get("mod+s");
hotkeyProvider.get(["mod+s"]);
hotkeyProvider.toggleCheatSheet();
hotkeyProvider.add(hotkeyObj.combo, hotkeyObj.description ,hotkeyObj.callback);
hotkeyProvider.bindTo(scope)
.add(hotkeyObj)
.add(hotkeyObj)
.add({
combo: 'w',
description: 'blah blah',
callback: function() {}
})
.add({
combo: ['w', 'mod+w'],
description: 'blah blah',
callback: function() {}
module('myApp', ['cfp.hotkeys'])
.config((hotkeysProvider: HotkeysProvider) => {
hotkeysProvider.includeCheatSheet = false;
const somehotKeyObj: Hotkey = {
combo: '',
callback: () => { }
};
});
function someInjectionService(
scope: ng.IScope,
hotkeyProvider: ng.hotkeys.HotkeysProvider,
hotkeyObj: ng.hotkeys.Hotkey
) {
hotkeyProvider.add("mod+s", "saves a file", (event: Event, hotkey: ng.hotkeys.Hotkey) => { });
hotkeyProvider.add(["mod+s"], "saves a file", (event: Event, hotkey: ng.hotkeys.Hotkey) => { });
hotkeyProvider.add(hotkeyObj);
hotkeyProvider.bindTo(scope);
hotkeyProvider.del("mod+s");
hotkeyProvider.del(["mod+s"]);
hotkeyProvider.get("mod+s");
hotkeyProvider.get(["mod+s"]);
hotkeyProvider.toggleCheatSheet();
hotkeyProvider.add(hotkeyObj.combo, hotkeyObj.description, hotkeyObj.callback);
hotkeyProvider.bindTo(scope)
.add(hotkeyObj)
.add(hotkeyObj)
.add({
combo: 'w',
description: 'blah blah',
callback: () => { }
})
.add({
combo: ['w', 'mod+w'],
description: 'blah blah',
callback: () => { }
});
hotkeyProvider.add({
combo: 'ctrl+w',
description: 'Description goes here',
callback: (event, hotkey) => {
event.preventDefault();
}
});
hotkeyProvider.add({
combo: 'ctrl+x',
callback: (event, hotkey) => {
//
}
});
hotkeyProvider.add({
combo: 'ctrl+w',
description: 'Description goes here',
allowIn: ['INPUT', 'SELECT', 'TEXTAREA'],
callback(event, hotkey) {
event.preventDefault();
}
});
}
+99 -24
View File
@@ -1,12 +1,10 @@
// Type definitions for angular-hotkeys
// Type definitions for angular-hotkeys 1.7
// Project: https://github.com/chieffancypants/angular-hotkeys
// Definitions by: Jason Zhao <https://github.com/jlz27>, Stefan Steinhart <https://github.com/reppners>
// Definitions by: Jason Zhao <https://github.com/jlz27>
// Stefan Steinhart <https://github.com/reppners>
// Cyril Gandon <https://github.com/cyrilgandon>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
//readme written by David Valentine <https://github.com/dvalenti314>
/// <reference types="angular" />
import * as ng from 'angular';
@@ -15,46 +13,123 @@ export type HotkeysProviderChained = ng.hotkeys.HotkeysProviderChained;
export type Hotkey = ng.hotkeys.Hotkey;
declare module 'angular' {
export namespace hotkeys {
namespace hotkeys {
interface HotkeysProvider {
template: string;
templateTitle: string;
/**
* Configurable setting to disable the cheatsheet entirely.
* @default true
*/
includeCheatSheet: boolean;
/**
* Configurable setting to disable ngRoute hooks.
*/
useNgRoute: boolean;
/**
* Configurable setting for the cheat sheet title
* @default 'Keyboard Shortcuts'
*/
templateTitle: string;
/**
* Configurable settings for the cheat sheet header in HTML.
* This overrides the normal title if specified.
* @default null
*/
templateHeader: string | null;
/**
* Configurable settings for the cheat sheet footer in HTML.
* @default null
*/
templateFooter: string | null;
/**
* Cheat sheet template in the event you want to totally customize it.
*/
template: string;
/**
* Configurable setting for the cheat sheet hotkey.
* @default '?'
*/
cheatSheetHotkey: string;
/**
* Configurable setting for the cheat sheet description.
* @default 'Show / hide this help menu'
*/
cheatSheetDescription: string;
add(combo: string | string[], callback: (event: Event, hotkey?: Hotkey) => void, action?: string, allowIn?: Array<string>, persistent?: boolean): ng.hotkeys.Hotkey;
/**
* Creates a new Hotkey and creates the Mousetrap binding.
*/
add(combo: string | string[], description?: string, callback?: (event: Event, hotkey: Hotkey) => void, action?: string, allowIn?: string[], persistent?: boolean): Hotkey;
add(combo: string | string[], description: string, callback: (event: Event, hotkey?: Hotkey) => void, action?: string, allowIn?: Array<string>, persistent?: boolean): ng.hotkeys.Hotkey;
/**
* Creates a new Hotkey and creates the Mousetrap binding.
*/
add(hotkeyObj: Hotkey): Hotkey;
add(hotkeyObj: ng.hotkeys.Hotkey): ng.hotkeys.Hotkey;
/**
* Binds the hotkey to a particular scope.
* Useful if the scope is destroyed, we can automatically destroy the hotkey binding.
* @param scope The scope to bind to
*/
bindTo(scope: IScope): HotkeysProviderChained;
bindTo(scope: ng.IScope): ng.hotkeys.HotkeysProviderChained;
/**
* Removes and unbinds a hotkey
* @param combo The keyboard combo (shortcut) or the HotKey object
*/
del(combo: string | string[] | Hotkey): void;
del(combo: string | string[]): void;
del(hotkeyObj: ng.hotkeys.Hotkey): void;
get(combo: string | string[]): ng.hotkeys.Hotkey;
/**
* Returns the Hotkey object
* @param combo The keyboard combo (shortcut)
*/
get(combo: string | string[]): Hotkey;
/**
* Toggles the help menu element's visiblity
*/
toggleCheatSheet(): void;
/**
* Purges all non-persistent hotkeys (such as those defined in routes)
*
* Without this, the same hotkey would get recreated everytime
* the route is accessed.
*/
purgeHotkeys(): void;
}
interface HotkeysProviderChained {
add(combo: string | string[], description: string, callback: (event: Event, hotkeys: ng.hotkeys.Hotkey) => void): HotkeysProviderChained;
add(combo: string | string[], description: string, callback: (event: Event, hotkeys: Hotkey) => void): HotkeysProviderChained;
add(hotkeyObj: ng.hotkeys.Hotkey): HotkeysProviderChained;
add(hotkeyObj: Hotkey): HotkeysProviderChained;
}
interface Hotkey {
/**
* They keyboard combo (shortcut) you want to bind to.
*/
combo: string | string[];
/**
* The description for what the combo does and is only used for the Cheat Sheet.
* If it is not supplied, it will not show up, and in effect, allows you to have unlisted hotkeys.
*/
description?: string;
callback: (event: Event, hotkey: ng.hotkeys.Hotkey) => void;
/**
* The function to execute when the key(s) are pressed. Passes along two arguments, event and hotkey
*/
callback(event: Event, hotkey: Hotkey): void;
/**
* The type of event to listen for, such as keypress, keydown or keyup.
* Usage of this parameter is discouraged as the underlying library will pick the most suitable option automatically.
* This should only be necessary in advanced situations.
*/
action?: string;
allowIn?: Array<string>;
/**
* An array of tag names to allow this combo in ('INPUT', 'SELECT', and/or 'TEXTAREA')
*/
allowIn?: Array<'INPUT' | 'SELECT' | 'TEXTAREA'>;
/**
* Whether the hotkey persists navigation events
*/
persistent?: boolean;
}
}
+2 -2
View File
@@ -7,7 +7,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
@@ -21,4 +21,4 @@
"index.d.ts",
"angular-hotkeys-tests.ts"
]
}
}
+1 -79
View File
@@ -1,79 +1 @@
{
"extends": "dtslint/dt.json",
"rules": {
"adjacent-overload-signatures": false,
"array-type": false,
"arrow-return-shorthand": false,
"ban-types": false,
"callable-types": false,
"comment-format": false,
"dt-header": false,
"eofline": false,
"export-just-namespace": false,
"import-spacing": false,
"interface-name": false,
"interface-over-type-literal": false,
"jsdoc-format": false,
"max-line-length": false,
"member-access": false,
"new-parens": false,
"no-any-union": false,
"no-boolean-literal-compare": false,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": false,
"no-construct": false,
"no-declare-current-package": false,
"no-duplicate-imports": false,
"no-duplicate-variable": false,
"no-empty-interface": false,
"no-for-in-array": false,
"no-inferrable-types": false,
"no-internal-module": false,
"no-irregular-whitespace": false,
"no-mergeable-namespace": false,
"no-misused-new": false,
"no-namespace": false,
"no-object-literal-type-assertion": false,
"no-padding": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-redundant-undefined": false,
"no-reference-import": false,
"no-relative-import-in-test": false,
"no-self-import": false,
"no-single-declare-module": false,
"no-string-throw": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-class": false,
"no-unnecessary-generics": false,
"no-unnecessary-qualifier": false,
"no-unnecessary-type-assertion": false,
"no-useless-files": false,
"no-var-keyword": false,
"no-var-requires": false,
"no-void-expression": false,
"no-trailing-whitespace": false,
"object-literal-key-quotes": false,
"object-literal-shorthand": false,
"one-line": false,
"one-variable-per-declaration": false,
"only-arrow-functions": false,
"prefer-conditional-expression": false,
"prefer-const": false,
"prefer-declare-function": false,
"prefer-for-of": false,
"prefer-method-signature": false,
"prefer-template": false,
"radix": false,
"semicolon": false,
"space-before-function-paren": false,
"space-within-parens": false,
"strict-export-declare-modifiers": false,
"trim-file": false,
"triple-equals": false,
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
}
}
{ "extends": "dtslint/dt.json" }
+7
View File
@@ -0,0 +1,7 @@
import union = require('arr-union');
// $ExpectType string[]
union(['a'], ['b', 'c'], ['d', 'e', 'f']);
// $ExpectType number[]
union([1, 1], [2, 3]);
+8
View File
@@ -0,0 +1,8 @@
// Type definitions for arr-union 3.1
// Project: https://github.com/jonschlinkert/arr-union
// Definitions by: mrmlnc <https://github.com/mrmlnc>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function union<T>(...arrays: Array<ArrayLike<T>>): T[];
export = union;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"arr-union-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+2 -2
View File
@@ -529,8 +529,8 @@ export class ManagementClient {
deleteEmailProvider(): Promise<any>;
deleteEmailProvider(cb?: (err: Error, data: any) => void): void;
updateEmailProvider(data: Data): Promise<any>;
updateEmailProvider(data: Data, cb?: (err: Error, data: any) => void): void;
updateEmailProvider(params: {}, data: Data): Promise<any>;
updateEmailProvider(params: {}, data: Data, cb?: (err: Error, data: any) => void): void;
// Statistics
+16
View File
@@ -159,6 +159,9 @@ function test_collection() {
var book1: Book = new Book({ title: "Title 1", author: "Mike" });
books.add(book1);
// Test adding sort option to add.
books.add(new Book(), { sort: true });
// Objects can be added to collection by casting to model type.
// Compiler will check if object properties are valid for the cast.
// This gives better type checking than declaring an `any` overload.
@@ -190,6 +193,7 @@ function test_collection() {
let modelsDict: _.Dictionary<Book[]>;
let num: number;
models = books.slice();
models = books.slice(1);
models = books.slice(1, 3);
@@ -405,6 +409,12 @@ namespace v1Changes {
validate: false
});
}
function test_set() {
var collection = new EmployeeCollection();
var model = new Employee();
collection.set([model], { add: false, remove: true, merge: false });
}
}
namespace Router {
@@ -415,4 +425,10 @@ namespace v1Changes {
router.navigate('/employees', true);
}
}
namespace Sync {
// Test for Backbone.sync override.
Backbone.sync('create', new Employee());
Backbone.sync('read', new EmployeeCollection());
}
}
+22 -2
View File
@@ -16,6 +16,13 @@ declare namespace Backbone {
interface AddOptions extends Silenceable {
at?: number;
merge?: boolean;
sort?: boolean;
}
interface CollectionSetOptions extends Silenceable {
add?: boolean;
remove?: boolean;
merge?: boolean;
}
interface HistoryOptions extends Silenceable {
@@ -243,7 +250,19 @@ declare namespace Backbone {
remove(model: {}|TModel, options?: Silenceable): TModel;
remove(models: ({}|TModel)[], options?: Silenceable): TModel[];
reset(models?: TModel[], options?: Silenceable): TModel[];
set(models?: TModel[], options?: Silenceable): TModel[];
/**
*
* The set method performs a "smart" update of the collection with the passed list of models.
* If a model in the list isn't yet in the collection it will be added; if the model is already in the
* collection its attributes will be merged; and if the collection contains any models that aren't present
* in the list, they'll be removed. All of the appropriate "add", "remove", and "change" events are fired as
* this happens. Returns the touched models in the collection. If you'd like to customize the behavior, you can
* disable it with options: {add: false}, {remove: false}, or {merge: false}.
* @param models
* @param options
*/
set(models?: TModel[], options?: CollectionSetOptions): TModel[];
shift(options?: Silenceable): TModel;
sort(options?: Silenceable): Collection<TModel>;
unshift(model: TModel, options?: AddOptions): TModel;
@@ -259,7 +278,7 @@ declare namespace Backbone {
/**
* Return a shallow copy of this collection's models, using the same options as native Array#slice.
*/
slice(min: number, max?: number): TModel[];
slice(min?: number, max?: number): TModel[];
// mixins from underscore
@@ -442,6 +461,7 @@ declare namespace Backbone {
// SYNC
function sync(method: string, model: Model, options?: JQueryAjaxSettings): any;
function sync(method: string, collection: Collection<Model>, options?: JQueryAjaxSettings): any;
function ajax(options?: JQueryAjaxSettings): JQueryXHR;
var emulateHTTP: boolean;
var emulateJSON: boolean;
+2 -2
View File
@@ -188,10 +188,10 @@ function CommonMethodsInEventStreamsAndProperties() {
return adds.takeUntil(cancel).map(x => x.val);
};
Bacon.sequentially(2, events)
Bacon.sequentially<string, {id:number; type:string; val?:number}>(2, events)
.groupBy(keyF, limitF)
.flatMap(groupedStream => groupedStream.fold(0, (acc, x) => acc + x))
.onValue(sum => {
.onValue((sum: number) => {
console.log(sum); // returns [-1, 2, 8] in an order
});
}
+21
View File
@@ -0,0 +1,21 @@
import bashGlob = require('bash-glob');
bashGlob('pattern', (err, files) => {});
bashGlob(['pattern'], (err, files) => {});
bashGlob(['pattern'], {}, (err, files) => {});
bashGlob(['pattern'], { cwd: 'cwd' }, (err, files) => { });
bashGlob.on('match', (match, cwd) => {});
bashGlob.on('files', (files, cwd) => {});
bashGlob.on('end', (files) => {});
bashGlob.each('pattern', (err, files) => {});
bashGlob.each(['pattern'], (err, files) => {});
bashGlob.each(['pattern'], {}, (err, files) => {});
bashGlob.each(['pattern'], { cwd: 'cwd' }, (err, files) => {});
// $ExpectType string[]
bashGlob.sync('pattern');
bashGlob.sync(['pattern']);
bashGlob.sync(['pattern'], {});
bashGlob.sync(['pattern'], { cwd: 'cwd' });
+36
View File
@@ -0,0 +1,36 @@
// Type definitions for bash-glob 2.0
// Project: https://github.com/micromatch/bash-glob
// Definitions by: mrmlnc <https://github.com/mrmlnc>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
type Patterns = string | string[];
type Callback = (err: Error, files: string[]) => void;
declare function bashGlob(pattern: Patterns, callback: Callback): void;
declare function bashGlob(pattern: Patterns, options: bashGlob.Options, callback: Callback): void;
declare namespace bashGlob {
interface Options {
cwd?: string;
dot?: boolean;
dotglob?: boolean;
extglob?: boolean;
failglob?: boolean;
globstar?: boolean;
nocase?: boolean;
nocaseglob?: boolean;
nullglob?: boolean;
}
function on(event: 'match' | 'files', callback: (files: string, cwd: string) => void): void;
function on(event: 'end', callback: (files: string) => void): void;
function each(patterns: Patterns, callback: Callback): void;
function each(patterns: Patterns, options: Options, callback: Callback): void;
function promise(patterns: Patterns, options?: Options): Promise<string[]>;
function sync(patterns: Patterns, options?: Options): string[];
}
export = bashGlob;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"bash-glob-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+21
View File
@@ -229,6 +229,27 @@ suite.add({
'onComplete': onComplete
});
// unregister a listener for an event type
suite.off('cycle', listener) as Benchmark.Suite;
// unregister a listener for multiple event types
suite.off('start cycle', listener) as Benchmark.Suite;
// unregister all listeners for an event type
suite.off('cycle') as Benchmark.Suite;
// unregister all listeners for multiple event types
suite.off('start cycle complete') as Benchmark.Suite;
// unregister all listeners for all event types
suite.off() as Benchmark.Suite;
// register a listener for an event type
suite.on('cycle', listener) as Benchmark.Suite;
// register a listener for multiple event types
suite.on('start cycle', listener) as Benchmark.Suite;
// basic usage
suite.run();
+4 -4
View File
@@ -170,10 +170,10 @@ declare namespace Benchmark {
join(separator?: string): string;
listeners(type: string): Function[];
map(callback: Function): any[];
off(type?: string, callback?: Function): Benchmark;
off(types: string[]): Benchmark;
on(type?: string, callback?: Function): Benchmark;
on(types: string[]): Benchmark;
off(type?: string, callback?: Function): Suite;
off(types: string[]): Suite;
on(type?: string, callback?: Function): Suite;
on(types: string[]): Suite;
pluck(property: string): any[];
pop(): Function;
push(benchmark: Benchmark): number;
@@ -0,0 +1,70 @@
import BScroll = require("better-scroll");
const BScroll1 = new BScroll('#wrapper');
const BScroll2 = new BScroll('#wrapper', { scrollX: false, scrollY: false });
const BScroll3 = new BScroll('#wrapper', {
snap: true,
wheel: false,
scrollbar: false,
pullDownRefresh: false,
});
const BScroll4 = new BScroll('#wrapper', {
wheel: {
selectedIndex: 0,
},
});
if (document.querySelector('div-test')) {
const BScroll6 = new BScroll('#wrapper', {
snap: {
loop: false,
el: document.querySelector('div-test')!,
threshold: 0.1,
stepX: 100,
stepY: 100,
listenFlick: true,
},
});
}
const BScroll7 = new BScroll('#wrapper', {
scrollbar: {
fade: true,
},
});
const BScroll8 = new BScroll('#wrapper', {
pullDownRefresh: {
threshold: 50,
stop: 20,
},
});
BScroll1.refresh();
BScroll1.scrollTo(0, 100);
BScroll1.scrollTo(0, 100, 200);
BScroll1.scrollToElement('selectedElement');
BScroll1.scrollToElement('selectedElement', 250);
BScroll1.scrollToElement(document.getElementById('selectedElement')!);
BScroll1.scrollToElement(document.getElementById('selectedElement')!, 250);
BScroll2.on('scrollStart', () => { console.log('scroll started'); });
const BScroll9 = new BScroll(document.getElementById('wrapper')!);
const BScroll10 = new BScroll(document.getElementById('wrapper')!, { freeScroll: true });
const BScroll11 = new BScroll(document.getElementById('wrapper')!, {
preventDefaultException: {
tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/,
},
});
const BScroll12 = new BScroll(document.getElementById('wrapper')!, {
preventDefaultException: {
className: /(^|\s)test(\s|$)/,
},
});
const BScroll13 = new BScroll(document.getElementById('wrapper')!, {
swipeBounceTime: 1000,
});
const BScroll14 = new BScroll('#wrapper', { disableMouse: true, disableTouch: false });
+148
View File
@@ -0,0 +1,148 @@
// Type definitions for better-scroll.js 1.3
// Project: https://github.com/ustbhuangyi/better-scroll
// Definitions by: linxiaowu66 <https://github.com/linxiaowu66>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
interface WheelOption {
selectedIndex?: number;
rotate?: number;
adjustTime?: number;
}
interface SlideOption {
loop?: boolean;
el?: Element;
threshold?: number;
stepX?: number;
stepY?: number;
listenFlick?: boolean;
}
interface ScrollBarOption {
fade?: boolean;
}
interface PullDownOption {
threshold?: number;
stop?: number;
}
interface PullUpOption {
threshold?: number;
}
interface BsOption {
startX?: number;
startY?: number;
scrollX?: boolean;
scrollY?: boolean;
freeScroll?: boolean;
directionLockThreshold?: number;
eventPassthrough?: string | boolean;
click?: boolean;
tap?: boolean;
bounce?: boolean;
bounceTime?: number;
momentum?: boolean;
momentumLimitTime?: number;
momentumLimitDistance?: number;
swipeTime?: number;
swipeBounceTime?: number;
deceleration?: number;
flickLimitTime?: number;
flickLimitDistance?: number;
resizePolling?: number;
probeType?: number;
preventDefault?: boolean;
preventDefaultException?: object;
HWCompositing?: boolean;
useTransition?: boolean;
useTransform?: boolean;
bindToWrapper?: boolean;
disableMouse?: boolean;
disableTouch?: boolean;
/**
* for picker
* wheel: {
* selectedIndex: 0;
* rotate: 25;
* adjustTime: 400
* }
*/
wheel?: WheelOption | boolean;
/**
* for slide
* snap: {
* loop?: boolean;
* el: domEl;
* threshold: 0.1;
* stepX: 100;
* stepY: 100;
* listenFlick: true
* }
*/
snap?: SlideOption | boolean;
/**
* for scrollbar
* scrollbar: {
* fade: true
* }
*/
scrollbar?: ScrollBarOption | boolean;
/**
* for pull down and refresh
* pullDownRefresh: {
* threshold: 50;
* stop: 20
* }
*/
pullDownRefresh?: PullDownOption | boolean;
/**
* for pull up and load
* pullUpLoad: {
* threshold: 50
* }
*/
pullUpLoad?: PullUpOption | boolean;
}
declare class BScroll {
constructor(element: Element | string, options?: BsOption);
// 重新计算 better-scroll,当 DOM 结构发生变化的时候务必要调用确保滚动的效果正常
x: number;
y: number;
refresh(): void;
// 启用 better-scroll; 默认 开启
enable(): void;
// 禁用 better-scroll,DOM 事件(如 touchstart、touchmove、touchend)的回调函数不再响应
disable(): void;
// 相对于当前位置偏移滚动 x;y 的距离
scrollBy(x: number, y: number, time?: number, easing?: object): void;
// 滚动到指定的位置
scrollTo(x: number, y: number, time?: number, easing?: object): void;
// 滚动到指定的目标元素
scrollToElement(el: HTMLElement | string, time?: number, offsetX?: number | boolean, offsetY?: number | boolean, easing?: object): void;
// 立即停止当前运行的滚动动画
stop(): void;
// 销毁 better-scroll,解绑事件
destroy(): void;
// 当我们做 slide 组件的时候,slide 通常会分成多个页面。调用此方法可以滚动到指定的页面。
goToPage(x: number, y: number, time?: number, easing?: object): void;
// 滚动到下一个页面
next(time: number, easing: object): void;
// 滚动到上一个页面
prev(time: number, easing: object): void;
// 获取当前页面的信息
getCurrentPage(): void;
// 当我们做 picker 组件的时候,调用该方法可以滚动到索引对应的位置
wheelTo(index: number): void;
// 获取当前选中的索引值
getSelectedIndex(): void;
// 当下拉刷新数据加载完毕后,需要调用此方法告诉 better-scroll 数据已加载
finishPullDown(): void;
// 当上拉加载数据加载完毕后,需要调用此方法告诉 better-scroll 数据已加载
finishPullUp(): void;
// 监听事件
on(type: string, fn: (evt?: any) => void): void;
off(type: string, fn?: (evt?: any) => void): void;
}
export = BScroll;
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"better-scroll-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
File diff suppressed because it is too large Load Diff
+2980 -2784
View File
File diff suppressed because it is too large Load Diff
+8 -9
View File
@@ -1,13 +1,13 @@
import Promise = require('bluebird');
import retry = require('bluebird-retry');
function promiseSuccess(text:string) {
function promiseSuccess(text: string) {
return Promise.resolve(text);
};
}
var count = 0;
let count = 0;
function myfunc() {
console.log('myfunc called ' + (++count) + ' times');
console.log(`myfunc called ${++count} times`);
if (count < 3) {
throw new Error('i fail the first two times');
} else {
@@ -16,18 +16,17 @@ function myfunc() {
}
retry(myfunc)
.done(function(result) { console.log(result); } );
.done(result => { console.log(result); });
//Options example
// Options example
function logFail() {
console.log(new Date().toISOString());
throw new Error('bail');
}
var options:retry.Options = {
const options: retry.Options = {
max_tries: 4,
interval: 500
};
retry(logFail, options);
retry(logFail, options);
+2 -5
View File
@@ -1,17 +1,15 @@
// Type definitions for bluebird-retry
// Type definitions for bluebird-retry 0.11
// Project: https://github.com/jut-io/bluebird-retry
// Definitions by: Pascal Vomhoff <https://github.com/pvomhoff>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
/// <reference types="bluebird" />
import Promise = require('bluebird');
declare function retry<T>(func: (param: T) => void, options?: retry.Options): Promise<T>;
declare namespace retry {
export interface Options {
interface Options {
interval?: number;
backoff?: number;
max_interval?: number;
@@ -22,7 +20,6 @@ declare namespace retry {
context?: any;
args?: any;
}
}
export = retry;
+1 -79
View File
@@ -1,79 +1 @@
{
"extends": "dtslint/dt.json",
"rules": {
"adjacent-overload-signatures": false,
"array-type": false,
"arrow-return-shorthand": false,
"ban-types": false,
"callable-types": false,
"comment-format": false,
"dt-header": false,
"eofline": false,
"export-just-namespace": false,
"import-spacing": false,
"interface-name": false,
"interface-over-type-literal": false,
"jsdoc-format": false,
"max-line-length": false,
"member-access": false,
"new-parens": false,
"no-any-union": false,
"no-boolean-literal-compare": false,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": false,
"no-construct": false,
"no-declare-current-package": false,
"no-duplicate-imports": false,
"no-duplicate-variable": false,
"no-empty-interface": false,
"no-for-in-array": false,
"no-inferrable-types": false,
"no-internal-module": false,
"no-irregular-whitespace": false,
"no-mergeable-namespace": false,
"no-misused-new": false,
"no-namespace": false,
"no-object-literal-type-assertion": false,
"no-padding": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-redundant-undefined": false,
"no-reference-import": false,
"no-relative-import-in-test": false,
"no-self-import": false,
"no-single-declare-module": false,
"no-string-throw": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-class": false,
"no-unnecessary-generics": false,
"no-unnecessary-qualifier": false,
"no-unnecessary-type-assertion": false,
"no-useless-files": false,
"no-var-keyword": false,
"no-var-requires": false,
"no-void-expression": false,
"no-trailing-whitespace": false,
"object-literal-key-quotes": false,
"object-literal-shorthand": false,
"one-line": false,
"one-variable-per-declaration": false,
"only-arrow-functions": false,
"prefer-conditional-expression": false,
"prefer-const": false,
"prefer-declare-function": false,
"prefer-for-of": false,
"prefer-method-signature": false,
"prefer-template": false,
"radix": false,
"semicolon": false,
"space-before-function-paren": false,
"space-within-parens": false,
"strict-export-declare-modifiers": false,
"trim-file": false,
"triple-equals": false,
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
}
}
{ "extends": "dtslint/dt.json" }
+12 -3
View File
@@ -6,10 +6,14 @@
/// <reference types="jquery" />
interface JQuery {
fileinput: (options?: BootstrapFileInput.FileInputOptions) => JQuery;
}
export = BootstrapFileInput;
export as namespace BootstrapFileInput;
declare global {
interface JQuery {
fileinput: (options?: BootstrapFileInput.FileInputOptions) => JQuery;
}
}
declare module BootstrapFileInput {
interface FileInputOptions {
@@ -19,6 +23,11 @@ declare module BootstrapFileInput {
The locale JS file for the language code must be defined as mentioned in the translations section: http://plugins.krajee.com/file-input#translations
*/
language?: string;
/**
* Theming
*/
theme?: string;
/**
Whether to display the file caption.
Defaults to true.
+2 -2
View File
@@ -5147,7 +5147,7 @@ declare namespace Box2D.Dynamics.Joints {
/**
* The pulley joint is connected to two bodies and two fixed ground points. The pulley supports a ratio such that: length1 + ratio length2 <= constant Yes, the force transmitted is scaled by the ratio. The pulley also enforces a maximum length limit on both sides. This is useful to prevent one side of the pulley hitting the top.
**/
export class b2PullyJoint extends b2Joint {
export class b2PulleyJoint extends b2Joint {
/**
* Get the anchor point on bodyA in world coordinates.
@@ -5207,7 +5207,7 @@ declare namespace Box2D.Dynamics.Joints {
/**
* Pulley joint definition. This requires two ground anchors, two dynamic body anchor points, max lengths for each side, and a pulley ratio.
**/
export class b2PullyJointDef extends b2JointDef {
export class b2PulleyJointDef extends b2JointDef {
/**
* The first ground anchor in world coordinates. This point never moves.
+586 -399
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -636,7 +636,7 @@ declare namespace c3 {
}
interface LineOptions {
value: number;
value: string | number | Date;
text?: string;
axis?: string;
position?: string;
@@ -1,9 +1,16 @@
import * as cassandra from 'cassandra-driver';
import * as util from 'util';
import * as fs from 'fs';
var client = new cassandra.Client({ contactPoints: ['h1', 'h2'], keyspace: 'ks1'});
const client = new cassandra.Client({
contactPoints: ['h1', 'h2'],
keyspace: 'ks1',
sslOptions: {
cert: fs.readFileSync('certFilePath')
}
});
var query = 'SELECT email, last_name FROM user_profiles WHERE key=?';
const 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].email);
});
+34 -33
View File
@@ -12,11 +12,12 @@ export type ResultCallback = (err: Error, result: types.ResultSet) => void;
import * as events from "events";
import * as stream from "stream";
import * as tls from "tls";
import _Long = require("long");
export namespace policies {
namespace addressResolution {
var EC2MultiRegionTranslator: EC2MultiRegionTranslatorStatic;
let EC2MultiRegionTranslator: EC2MultiRegionTranslatorStatic;
interface AddressTranslator {
translate(address: string, port: number, callback: Callback): void;
@@ -32,10 +33,10 @@ export namespace policies {
}
namespace loadBalancing {
var DCAwareRoundRobinPolicy: DCAwareRoundRobinPolicyStatic;
var RoundRobinPolicy: RoundRobinPolicyStatic;
var TokenAwarePolicy: TokenAwarePolicyStatic;
var WhiteListPolicy: WhiteListPolicyStatic;
let DCAwareRoundRobinPolicy: DCAwareRoundRobinPolicyStatic;
let RoundRobinPolicy: RoundRobinPolicyStatic;
let TokenAwarePolicy: TokenAwarePolicyStatic;
let WhiteListPolicy: WhiteListPolicyStatic;
interface LoadBalancingPolicy {
init(client: Client, hosts: HostMap, callback: Callback): void;
@@ -72,8 +73,8 @@ export namespace policies {
}
namespace reconnection {
var ConstantReconnectionPolicy: ConstantReconnectionPolicyStatic;
var ExponentialReconnectionPolicy: ExponentialReconnectionPolicyStatic;
let ConstantReconnectionPolicy: ConstantReconnectionPolicyStatic;
let ExponentialReconnectionPolicy: ExponentialReconnectionPolicyStatic;
interface ReconnectionPolicy {
newSchedule(): { next: Function };
@@ -93,7 +94,7 @@ export namespace policies {
}
namespace retry {
var RetryPolicy: RetryPolicyStatic;
let RetryPolicy: RetryPolicyStatic;
interface DecisionInfo {
decision: number;
@@ -128,18 +129,18 @@ export namespace policies {
}
export namespace types {
var BigDecimal: BigDecimalStatic;
var InetAddress: InetAddressStatic;
var Integer: IntegerStatic;
var LocalDate: LocalDateStatic;
var LocalTime: LocalTimeStatic;
var Long: _Long;
var ResultSet: ResultSetStatic;
// var ResultStream: ResultStreamStatic;
var Row: RowStatic;
var TimeUuid: TimeUuidStatic;
var Tuple: TupleStatic;
var Uuid: UuidStatic;
let BigDecimal: BigDecimalStatic;
let InetAddress: InetAddressStatic;
let Integer: IntegerStatic;
let LocalDate: LocalDateStatic;
let LocalTime: LocalTimeStatic;
let Long: _Long;
let ResultSet: ResultSetStatic;
// let ResultStream: ResultStreamStatic;
let Row: RowStatic;
let TimeUuid: TimeUuidStatic;
let Tuple: TupleStatic;
let Uuid: UuidStatic;
enum consistencies {
any = 0,
@@ -433,10 +434,10 @@ export namespace types {
}
}
export var Client: ClientStatic;
export var Host: HostStatic;
export var HostMap: HostMapStatic;
export var Encoder: EncoderStatic;
export let Client: ClientStatic;
export let Host: HostStatic;
export let HostMap: HostMapStatic;
export let Encoder: EncoderStatic;
export interface ClientOptions {
contactPoints: Array<string>,
@@ -468,7 +469,7 @@ export interface ClientOptions {
coalescingThreshold: number
},
authProvider?: auth.AuthProvider,
sslOptions?: any,
sslOptions?: tls.ConnectionOptions,
encoding?: {
map: Function,
set: Function,
@@ -564,8 +565,8 @@ export interface Encoder {
}
export namespace auth {
var Authenticator: AuthenticatorStatic;
var PlainTextAuthProvider: PlainTextAuthProviderStatic;
let Authenticator: AuthenticatorStatic;
let PlainTextAuthProvider: PlainTextAuthProviderStatic;
interface AuthenticatorStatic {
new (): Authenticator;
@@ -623,12 +624,12 @@ export namespace errors {
}
export namespace metadata {
var Aggregate: AggregateStatic;
var Index: IndexStatic;
var MaterializedView: MaterializedViewStatic;
var Metadata: MetadataStatic;
var SchemaFunction: SchemaFunctionStatic;
var TableMetadata: TableMetadataStatic;
let Aggregate: AggregateStatic;
let Index: IndexStatic;
let MaterializedView: MaterializedViewStatic;
let Metadata: MetadataStatic;
let SchemaFunction: SchemaFunctionStatic;
let TableMetadata: TableMetadataStatic;
type caching = "all" | "keys_only" | "rows_only" | "none";
+3 -10
View File
@@ -5547,19 +5547,12 @@ declare namespace chrome.storage {
*/
set(items: Object, callback?: () => void): void;
/**
* Removes one item from storage.
* @param key A single key for items to remove.
* Removes one or more items from storage.
* @param A single key or a list of keys for items to remove.
* @param callback Optional.
* Callback on success, or on failure (in which case runtime.lastError will be set).
*/
remove(key: string, callback?: () => void): void;
/**
* Removes items from storage.
* @param keys A list of keys for items to remove.
* @param callback Optional.
* Callback on success, or on failure (in which case runtime.lastError will be set).
*/
remove(keys: string[], callback?: () => void): void;
remove(keys: string | string[], callback?: () => void): void;
/**
* Gets one or more items from storage.
* @param callback Callback with storage items, or on failure (in which case runtime.lastError will be set).
+1 -1
View File
@@ -1,6 +1,6 @@
// Type definitions for cleave.js 1.0
// Project: https://github.com/nosir/cleave.js
// Definitions by: C Lentfort <https://github.com/clentfort>
// Definitions by: C Lentfort <https://github.com/clentfort>, J Giancono <https://github.com/jasongi-at-sportsbet>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
+4 -1
View File
@@ -10,6 +10,8 @@ export type CreditCardType =
| "mastercard"
| "uatp"
| "unknown"
| "unionPay"
| "mir"
| "visa";
export type CreditCardTypeChangeHandler = (owner: HTMLInputElement, type: CreditCardType) => void;
@@ -33,7 +35,7 @@ export interface CleaveOptions {
}
// Numeral Options
export type NumeralThousandsGroupStyleType = "lakh" | "thousand" | "wan";
export type NumeralThousandsGroupStyleType = "lakh" | "thousand" | "wan" | "none";
export interface CleaveOptions {
numeral?: boolean;
@@ -55,6 +57,7 @@ export interface CleaveOptions {
lowercase?: boolean;
numericOnly?: boolean;
prefix?: string;
noImmediatePrefix?: boolean;
rawValueTrimPrefix?: boolean;
uppercase?: boolean;
}
+2 -1
View File
@@ -52,7 +52,8 @@ cli.main(function (args, options) {
}
return str;
}
for (i = 0, l = this.argc; i < l; i++) {
var l: number = this.argc;
for (i = 0; i < l; i++) {
args[i] = escape(args[i]);
}
options.separator = escape(options.separator);
+1 -1
View File
@@ -692,7 +692,7 @@ declare namespace CodeMirror {
interface EditorChangeCancellable extends CodeMirror.EditorChange {
/** may be used to modify the change. All three arguments to update are optional, and can be left off to leave the existing value for that field intact. */
update(from?: CodeMirror.Position, to?: CodeMirror.Position, text?: string): void;
update(from?: CodeMirror.Position, to?: CodeMirror.Position, text?: string[]): void;
cancel(): void;
}
@@ -0,0 +1,4 @@
import stdev = require('compute-stdev');
// $ExpectType number
stdev([1, 2, 3]);
+8
View File
@@ -0,0 +1,8 @@
// Type definitions for compute-stdev 1.0
// Project: https://github.com/compute-io/stdev
// Definitions by: mrmlnc <https://github.com/mrmlnc>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function stdev(data: ArrayLike<number>): number;
export = stdev;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"compute-stdev-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+1 -1
View File
@@ -18,7 +18,7 @@ export interface MediaType {
}
export interface RequestLike {
headers: {[header: string]: string | string[]};
headers: {[header: string]: string | string[] | undefined};
}
export interface ResponseLike {
+1
View File
@@ -25,6 +25,7 @@ declare namespace daterangepicker {
startDate: moment.Moment;
endDate: moment.Moment;
container: JQuery;
setStartDate(date: Date | moment.Moment | string): void;
setEndDate(date: Date | moment.Moment | string): void;
+51 -37
View File
@@ -4,77 +4,91 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace echarts {
function init(dom:HTMLDivElement|HTMLCanvasElement, theme?:Object|string, opts?:{
function init(dom: HTMLDivElement | HTMLCanvasElement, theme?: Object | string, opts?: {
devicePixelRatio?: number
renderer?: string
}):ECharts;
}): ECharts;
const graphic: {
clipPointsByRect(points: number[][], rect: ERectangle): number[][];
clipRectByRect(targetRect: ERectangle, rect: ERectangle): ERectangle;
LinearGradient: { new (x: number, y: number, x2: number, y2: number, colorStops: Array<Object>, globalCoord?: boolean): LinearGradient }
};
function connect(group: string | Array<string>): void;
function disConnect(group: string): void;
function dispose(target: ECharts | HTMLDivElement | HTMLCanvasElement): void;
function getInstanceByDom(target: HTMLDivElement | HTMLCanvasElement): void;
function registerMap(mapName: string, geoJson: Object, specialAreas?: Object): void;
function registerTheme(themeName: string, theme: Object): void;
interface LinearGradient {
colorStops: Array<Object>;
global: boolean;
type: string;
x: number
x2: number
y: number
y2: number
}
function connect(group:string|Array<string>):void;
function disConnect(group:string):void;
function dispose(target:ECharts|HTMLDivElement|HTMLCanvasElement):void;
function getInstanceByDom(target:HTMLDivElement|HTMLCanvasElement):void;
function registerMap(mapName:string, geoJson:Object, specialAreas?:Object):void;
function registerTheme(themeName:string, theme:Object):void;
interface ECharts {
group:string;
group: string;
setOption(option:EChartOption, notMerge?:boolean, notRefreshImmediately?:boolean):void
setOption(option: EChartOption, notMerge?: boolean, notRefreshImmediately?: boolean): void
getWidth():number
getWidth(): number
getHeight():number
getHeight(): number
getDom():HTMLCanvasElement|HTMLDivElement
getDom(): HTMLCanvasElement | HTMLDivElement
getOption():Object
getOption(): Object
resize():void
resize(): void
dispatchAction(payload:Object):void
dispatchAction(payload: Object): void
on(eventName:string, handler:Function, context?:Object):void
on(eventName: string, handler: Function, context?: Object): void
off(eventName:string, handler?:Function):void
off(eventName: string, handler?: Function): void
showLoading(type?:string, opts?:Object):void
showLoading(type?: string, opts?: Object): void
hideLoading():void
hideLoading(): void
getDataURL(opts:{
getDataURL(opts: {
// 导出的格式,可选 png, jpeg
type?: string,
// 导出的图片分辨率比例,默认为 1。
pixelRatio?: number,
// 导出的图片背景色,默认使用 option 里的 backgroundColor
backgroundColor?: string
}):string
}): string
getConnectedDataURL(opts:{
getConnectedDataURL(opts: {
// 导出的格式,可选 png, jpeg
type: string,
// 导出的图片分辨率比例,默认为 1。
pixelRatio: number,
// 导出的图片背景色,默认使用 option 里的 backgroundColor
backgroundColor: string
}):string
}): string
clear():void
clear(): void
isDisposed():boolean
isDisposed(): boolean
dispose(): void
dispose():void
// 转换逻辑点到像素
convertToPixel(finder: {
seriesIndex?: number,
@@ -92,8 +106,8 @@ declare namespace echarts {
gridIndex?: number,
gridId?: string
gridName?: string
} | string, value: string|Array<any>): string|Array<any>
} | string, value: string | Array<any>): string | Array<any>
convertFromPixel(finder: {
seriesIndex?: number,
seriesId?: string,
@@ -110,7 +124,7 @@ declare namespace echarts {
gridIndex?: number,
gridId?: string
gridName?: string
} | string, value: Array<any>|string): Array<any>|string
} | string, value: Array<any> | string): Array<any> | string
}
interface ERectangle {
@@ -177,6 +191,6 @@ declare namespace echarts {
}
}
declare module "echarts" {
declare module 'echarts' {
export = echarts;
}
+20
View File
@@ -0,0 +1,20 @@
import React = require('react');
import { EmojiData } from '..';
import { Emoji, EmojiProps, I18n } from '.';
export interface Props {
emojis?: Array<string|EmojiData>;
hasStickyPosition?: boolean;
name: string;
native: boolean;
perLine: number;
emojiProps: EmojiProps;
recent?: string[];
i18n: I18n;
}
export default class Category extends React.Component<Props> {
// all methods and properties inside this are most likely intended to be private
}
+31
View File
@@ -0,0 +1,31 @@
import React = require('react');
import { EmojiData, EmojiSkin } from '..';
export type BackgroundImageFn = (set: EmojiSet, sheetSize: EmojiSheetSize) => string;
export type EmojiSet = 'apple'|'google'|'twitter'|'emojione'|'messenger'|'facebook';
export type EmojiSheetSize = 16|20|32|64;
export interface Props {
onOver?(emoji: EmojiData, e: React.MouseEvent<HTMLElement>): void;
onLeave?(emoji: EmojiData, e: React.MouseEvent<HTMLElement>): void;
onClick?(emoji: EmojiData, e: React.MouseEvent<HTMLElement>): void;
/** defaults to returning a png from unpkg.com-hosted emoji-datasource-${set} */
backgroundImageFn?: BackgroundImageFn;
native?: boolean;
forceSize?: boolean;
tooltip?: boolean;
/** defaults to 1 */
skin?: EmojiSkin;
/** defaults to 64 */
sheetSize?: EmojiSheetSize;
/** defaults to 'apple' */
set?: EmojiSet;
size: number;
emoji: string|EmojiData;
}
// tslint:disable-next-line strict-export-declare-modifiers
declare const Emoji: React.SFC<Props>;
export { Emoji as default };
+4
View File
@@ -0,0 +1,4 @@
// The other exports on the components folder are not public API
export { default as Category, Props as CategoryProps } from './category';
export { default as Emoji, Props as EmojiProps, BackgroundImageFn, EmojiSet, EmojiSheetSize } from './emoji';
export { default as Picker, Props as PickerProps, I18n, PartialI18n, CustomEmoji } from './picker';
+54
View File
@@ -0,0 +1,54 @@
import React = require('react');
import { EmojiData, EmojiSkin } from '..';
import { Category, Emoji, EmojiProps, BackgroundImageFn, EmojiSet, EmojiSheetSize } from '.';
// tslint:disable-next-line interface-name
export interface I18n {
search: string;
categories: Record<'search'|'recent'|'people'|'nature'|'foods'|'activity'|'places'|'objects'|'symbols'|'flags'|'custom', string>;
notfound: string;
}
export type PartialI18n = Partial<Pick<I18n, 'search'|'notfound'> & { categories: Partial<I18n['categories']>}>;
export interface CustomEmoji {
// id is overridden by short_names[0]
name: string;
/** Must contain at least one name. The first name is used as the unique id. */
short_names: string[];
emoticons?: string[];
keywords?: string[];
imageUrl: string;
}
export interface Props {
/** NOTE: default is not preventable */
onClick?(emoji: EmojiData, e: React.MouseEvent<HTMLElement>): void;
perLine?: number;
emojiSize?: number;
i18n?: PartialI18n;
style?: React.CSSProperties;
title?: string;
emoji?: string;
color?: string;
set?: EmojiSet;
skin?: EmojiSkin;
native?: boolean;
backgroundImageFn?: BackgroundImageFn;
sheetSize?: EmojiSheetSize;
emojisToShowFilter?(emoji: EmojiData): boolean;
showPreview?: boolean;
emojiTooltip?: boolean;
include?: string[];
exclude?: string[];
recent?: string[];
autoFocus?: boolean;
/** NOTE: custom emoji are copied into a singleton object on every new mount */
custom: CustomEmoji[];
}
export default class Picker extends React.PureComponent<Props> {
// everything inside it is supposed to be private
}
+15
View File
@@ -0,0 +1,15 @@
export { default as emojiIndex, EmojiData, EmojiSkin } from './utils/emoji-index';
export { default as store, StoreHandlers } from './utils/store';
export { default as frequently } from './utils/frequently';
export {
Picker,
PickerProps,
I18n,
PartialI18n,
CustomEmoji,
Emoji,
EmojiProps,
Category,
CategoryProps
} from './components';
+25
View File
@@ -0,0 +1,25 @@
export type EmojiSkin = 1|2|3|4|5|6;
export interface EmojiData {
id: string;
name: string;
colons: string;
/** Reverse mapping to keyof emoticons */
emoticons: string[];
unified: string;
skin: EmojiSkin|null;
native: string;
}
// tslint:disable-next-line strict-export-declare-modifiers
declare const _default: {
search(query: ''): null
search(query: string): EmojiData|null
emojis: { [emoji: string]: EmojiData }
/** Mapping of string to keyof emojis */
emoticons: { [emoticon: string]: string }
};
export { _default as default };
+9
View File
@@ -0,0 +1,9 @@
import { EmojiData } from '..';
// tslint:disable-next-line strict-export-declare-modifiers
declare const _default: {
add(emoji: Pick<EmojiData, 'id'>): void
get(perLine: number): string[]
};
export { _default as default };
+15
View File
@@ -0,0 +1,15 @@
export interface StoreHandlers {
getter?(key: string): any;
setter?(key: string, value: any): void;
}
// tslint:disable-next-line strict-export-declare-modifiers
declare const _default: {
setHandlers(handlers?: StoreHandlers): void
setNamespace(namespace: string): void
update(state: {[key: string]: any}): void
set(key: string, value: any): void
get(key: string): any
};
export { _default as default };
+93
View File
@@ -0,0 +1,93 @@
// Port of https://github.com/missive/emoji-mart/blob/master/src/components/emoji.js
import React = require('react');
import { Picker, Emoji, EmojiProps, CustomEmoji } from 'emoji-mart';
declare var console: { log(...args: any[]): void; };
const CUSTOM_EMOJIS: CustomEmoji[] = [
{
name: 'Party Parrot',
short_names: ['parrot'],
keywords: ['party'],
imageUrl: 'http://cultofthepartyparrot.com/parrots/hd/parrot.gif'
},
{
name: 'Octocat',
short_names: ['octocat'],
keywords: ['github'],
imageUrl: 'https://assets-cdn.github.com/images/icons/emoji/octocat.png?v7'
},
{
name: 'Squirrel',
short_names: ['shipit', 'squirrel'],
keywords: ['github'],
imageUrl: 'https://assets-cdn.github.com/images/icons/emoji/shipit.png?v7'
},
];
interface State {
native: boolean;
set: EmojiProps['set']|'native';
emoji: string;
title: string;
custom: CustomEmoji[];
}
class Example extends React.Component<{}, State> {
readonly state: Readonly<State> = {
native: true,
set: 'apple',
emoji: 'point_up',
title: 'Pick your emoji…',
custom: CUSTOM_EMOJIS
};
render() {
return (
<div>
<div className="row">
<h1>Emoji Mart 🏬</h1>
</div>
<div className="row">
{(['native', 'apple', 'google', 'twitter', 'emojione', 'messenger', 'facebook'] as Array<EmojiProps['set']|'native'>).map((set) => {
const props = { disabled: !this.state.native && set === this.state.set };
if (set === 'native' && this.state.native) {
props.disabled = true;
}
return (
<button
key={set}
value={set}
onClick={() => {
if (set === 'native') {
this.setState({ native: true });
} else {
this.setState({ set, native: false });
}
}}
{...props}
>
{set}
</button>
);
})}
</div>
<div className="row">
<Picker
{...this.state}
// NOTE: The original code passes the this.state directly, which includes a potential
// invalid 'set' value. The value of 'set' happens to be ignored if native is true, but no
// good way to represent it in the typings.
set={this.state.set === 'native' ? undefined : this.state.set}
onClick={console.log}
/>
</div>
</div>
);
}
}
+9
View File
@@ -0,0 +1,9 @@
// Type definitions for emoji-mart 2.2
// Project: https://github.com/missive/emoji-mart
// Definitions by: Diogo Franco <https://github.com/Kovensky>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.4
// These definitions should work with 2.3, but the tests doesn't pass on 2.3.
export * from './dist-es';
+32
View File
@@ -0,0 +1,32 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "react"
},
"files": [
"index.d.ts",
"dist-es/components/category.d.ts",
"dist-es/components/emoji.d.ts",
"dist-es/components/index.d.ts",
"dist-es/components/picker.d.ts",
"dist-es/utils/emoji-index.d.ts",
"dist-es/utils/frequently.d.ts",
"dist-es/utils/store.d.ts",
"dist-es/index.d.ts",
"emoji-mart-tests.tsx"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -1,3 +0,0 @@
ErrorStackParser.parse(new Error('Boom'));
-26
View File
@@ -1,26 +0,0 @@
// Type definitions for ErrorStackParser v1.3.3
// Project: https://github.com/stacktracejs/error-stack-parser
// Definitions by: Eric Wendelin <https://www.eriwen.com>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare module ErrorStackParser {
export interface StackFrame {
constructor(functionName: string, args: any, fileName: string, lineNumber: number, columnNumber: number, source: string): StackFrame;
functionName?: string;
args?: any[];
fileName?: string;
lineNumber?: number;
columnNumber?: number;
source?: string;
toString(): string;
}
/**
* Given an Error object, extract the most information from it.
*
* @param {Error} error object
* @return {Array} of StackFrames
*/
export function parse(error: Error): StackFrame[];
}
-79
View File
@@ -1,79 +0,0 @@
{
"extends": "dtslint/dt.json",
"rules": {
"adjacent-overload-signatures": false,
"array-type": false,
"arrow-return-shorthand": false,
"ban-types": false,
"callable-types": false,
"comment-format": false,
"dt-header": false,
"eofline": false,
"export-just-namespace": false,
"import-spacing": false,
"interface-name": false,
"interface-over-type-literal": false,
"jsdoc-format": false,
"max-line-length": false,
"member-access": false,
"new-parens": false,
"no-any-union": false,
"no-boolean-literal-compare": false,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": false,
"no-construct": false,
"no-declare-current-package": false,
"no-duplicate-imports": false,
"no-duplicate-variable": false,
"no-empty-interface": false,
"no-for-in-array": false,
"no-inferrable-types": false,
"no-internal-module": false,
"no-irregular-whitespace": false,
"no-mergeable-namespace": false,
"no-misused-new": false,
"no-namespace": false,
"no-object-literal-type-assertion": false,
"no-padding": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-redundant-undefined": false,
"no-reference-import": false,
"no-relative-import-in-test": false,
"no-self-import": false,
"no-single-declare-module": false,
"no-string-throw": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-class": false,
"no-unnecessary-generics": false,
"no-unnecessary-qualifier": false,
"no-unnecessary-type-assertion": false,
"no-useless-files": false,
"no-var-keyword": false,
"no-var-requires": false,
"no-void-expression": false,
"no-trailing-whitespace": false,
"object-literal-key-quotes": false,
"object-literal-shorthand": false,
"one-line": false,
"one-variable-per-declaration": false,
"only-arrow-functions": false,
"prefer-conditional-expression": false,
"prefer-const": false,
"prefer-declare-function": false,
"prefer-for-of": false,
"prefer-method-signature": false,
"prefer-template": false,
"radix": false,
"semicolon": false,
"space-before-function-paren": false,
"space-within-parens": false,
"strict-export-declare-modifiers": false,
"trim-file": false,
"triple-equals": false,
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
}
}
+41 -40
View File
@@ -1,7 +1,8 @@
// Type definitions for execa 0.7
// Type definitions for execa 0.8
// Project: https://github.com/sindresorhus/execa#readme
// Definitions by: Douglas Duteil <https://github.com/douglasduteil>
// BendingBender <https://github.com/BendingBender>
// Borek Bernard <https://github.com/borekb>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
@@ -10,46 +11,46 @@
import { ChildProcess, ExecOptions, SpawnOptions, SpawnSyncOptions } from "child_process";
import { Stream } from 'stream';
type StdIOOption = 'pipe' | 'ipc' | 'ignore' | number | Stream | undefined | null;
interface ExecaOptions {
input: string | Buffer | Stream;
preferLocal: boolean;
stripEof: boolean;
extendEnv: boolean;
argv0: string;
localDir: string;
reject: boolean;
cleanup: boolean;
stdin: StdIOOption;
stdout: StdIOOption;
stderr: StdIOOption;
}
type Options = SpawnOptions & ExecaOptions & ExecOptions;
type SyncOptions = SpawnSyncOptions & ExecaOptions & ExecOptions;
interface ExecaReturns {
cmd: string;
code: number;
failed: boolean;
killed: boolean;
signal: string | null;
stderr: string;
stdout: string;
timedOut: boolean;
}
type ExecaError = Error & ExecaReturns;
interface ExecaChildPromise {
catch<TResult = never>(onrejected?: ((reason: ExecaError) => TResult | PromiseLike<TResult>) | null): Promise<ExecaReturns | TResult>;
}
type ExecaChildProcess = ChildProcess & ExecaChildPromise & Promise<ExecaReturns>;
declare function execa(file: string, options?: Partial<Options>): ExecaChildProcess;
declare function execa(file: string, args?: string[], options?: Partial<Options>): ExecaChildProcess;
declare function execa(file: string, options?: Partial<execa.Options>): execa.ExecaChildProcess;
declare function execa(file: string, args?: string[], options?: Partial<execa.Options>): execa.ExecaChildProcess;
declare namespace execa {
type StdIOOption = 'pipe' | 'ipc' | 'ignore' | number | Stream | undefined | null;
interface ExecaOptions {
input: string | Buffer | Stream;
preferLocal: boolean;
stripEof: boolean;
extendEnv: boolean;
argv0: string;
localDir: string;
reject: boolean;
cleanup: boolean;
stdin: StdIOOption;
stdout: StdIOOption;
stderr: StdIOOption;
}
type Options = SpawnOptions & ExecaOptions & ExecOptions;
type SyncOptions = SpawnSyncOptions & ExecaOptions & ExecOptions;
interface ExecaReturns {
cmd: string;
code: number;
failed: boolean;
killed: boolean;
signal: string | null;
stderr: string;
stdout: string;
timedOut: boolean;
}
type ExecaError = Error & ExecaReturns;
interface ExecaChildPromise {
catch<TResult = never>(onrejected?: ((reason: ExecaError) => TResult | PromiseLike<TResult>) | null): Promise<ExecaReturns | TResult>;
}
type ExecaChildProcess = ChildProcess & ExecaChildPromise & Promise<ExecaReturns>;
function stdout(file: string, options?: Partial<Options>): Promise<string>;
function stdout(file: string, args?: string[], options?: Partial<Options>): Promise<string>;
function stderr(file: string, options?: Partial<Options>): Promise<string>;
@@ -0,0 +1,6 @@
import cluster = require('express-cluster');
() => {
cluster(worker => {}, {count: 5});
cluster({count: 5}, worker => {});
};
+26
View File
@@ -0,0 +1,26 @@
// Type definitions for express-cluster 0.0
// Project: https://github.com/Flipboard/express-cluster
// Definitions by: Miloslav Nenadál <https://github.com/nenadalm>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import cluster = require('cluster');
interface Config {
count?: number;
respawn?: boolean;
verbose?: boolean;
workerListener?(): void;
outputStream?: NodeJS.WritableStream;
}
type WorkerFunction = (worker: cluster.Worker) => void;
interface Cluster {
(fn: WorkerFunction, config: Config): void;
(config: Config, fn: WorkerFunction): void;
}
declare const c: Cluster;
export = c;
@@ -6,7 +6,7 @@
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": false,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
@@ -18,6 +18,6 @@
},
"files": [
"index.d.ts",
"error-stack-parser-tests.ts"
"express-cluster-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
@@ -0,0 +1,83 @@
import ExpressOAuthServer = require("express-oauth-server");
import * as OAuth2Server from "oauth2-server";
import * as express from "express";
const oauth2Model: OAuth2Server.AuthorizationCodeModel = {
getClient: async (clientId: string, clientSecret: string): Promise<OAuth2Server.Client | OAuth2Server.Falsey> => {
return undefined;
},
saveToken: async (token: OAuth2Server.Token, client: OAuth2Server.Client, user: OAuth2Server.User): Promise<OAuth2Server.Token> => {
return token;
},
getAccessToken: async (accessToken: string): Promise<OAuth2Server.Token> => {
return {
accessToken,
client: {id: "testClient", grants: ["access_token"]},
user: {id: "testUser"}
};
},
verifyScope: async (token: OAuth2Server.Token, scope: string): Promise<boolean> => {
return true;
},
getAuthorizationCode: async (authorizationCode: string): Promise<OAuth2Server.AuthorizationCode> => {
return {
authorizationCode,
expiresAt: new Date(),
redirectUri: "www.test.com",
client: {id: "testClient", grants: ["access_token"]},
user: {id: "testUser"}
};
},
saveAuthorizationCode: async (code: OAuth2Server.AuthorizationCode, client: OAuth2Server.Client, user: OAuth2Server.User): Promise<OAuth2Server.AuthorizationCode> => {
return code;
},
revokeAuthorizationCode: async (code: OAuth2Server.AuthorizationCode): Promise<boolean> => {
return true;
}
};
const serverOptions: OAuth2Server.ServerOptions = {
model: oauth2Model,
};
const expressOAuthServer: ExpressOAuthServer = new ExpressOAuthServer(serverOptions);
let oAuthServer: OAuth2Server;
let resultingTokenMiddleware: (
request: express.Request,
response: express.Response,
next: express.NextFunction,
) => Promise<OAuth2Server.Token>;
let resultingAuthorizationCodeMiddleware: (
request: express.Request,
response: express.Response,
next: express.NextFunction,
) => Promise<OAuth2Server.AuthorizationCode>;
oAuthServer = expressOAuthServer.server;
resultingTokenMiddleware = expressOAuthServer.authenticate();
resultingTokenMiddleware = expressOAuthServer.token();
resultingAuthorizationCodeMiddleware = expressOAuthServer.authorize();
// Real-life example
const expressApp = express();
expressApp.all(
"/path",
expressOAuthServer.authenticate(),
(req: express.Request, res: express.Response, next: express.NextFunction) => {
res.json({message: "Secure data"});
},
);
expressApp.get(
"/profile",
expressOAuthServer.authenticate({scope: "profile"}),
(req: express.Request & {user?: OAuth2Server.Token}, res: express.Response, next: express.NextFunction) => {
res.json({
profile: req.user
});
},
);
expressApp.listen(1234);
+34
View File
@@ -0,0 +1,34 @@
// Type definitions for express-oauth-server 2.0
// Project: https://github.com/oauthjs/express-oauth-server#readme
// Definitions by: Arne Schubert <https://github.com/atd-schubert>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
import * as express from 'express';
import * as OAuth2Server from 'oauth2-server';
declare class ExpressOAuthServer {
server: OAuth2Server;
constructor(options: OAuth2Server.ServerOptions);
authenticate(options?: OAuth2Server.AuthenticateOptions): (
request: express.Request,
response: express.Response,
next: express.NextFunction,
) => Promise<OAuth2Server.Token>;
authorize(options?: OAuth2Server.AuthorizeOptions): (
request: express.Request,
response: express.Response,
next: express.NextFunction,
) => Promise<OAuth2Server.AuthorizationCode>;
token(options?: OAuth2Server.TokenOptions): (
request: express.Request,
response: express.Response,
next: express.NextFunction,
) => Promise<OAuth2Server.Token>;
}
export = ExpressOAuthServer;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"express-oauth-server-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+89 -10
View File
@@ -1,5 +1,3 @@
let resultStr: string;
let resultBool: boolean;
let resultNum: number;
@@ -17,7 +15,7 @@ resultStr = faker.address.cityPrefix();
resultStr = faker.address.citySuffix();
resultStr = faker.address.streetName();
resultStr = faker.address.streetAddress();
resultStr = faker.address.streetAddress(false);;
resultStr = faker.address.streetAddress(false);
resultStr = faker.address.streetSuffix();
resultStr = faker.address.streetPrefix();
resultStr = faker.address.secondaryAddress();
@@ -63,6 +61,8 @@ resultDate = faker.date.between('foo', 'bar');
resultDate = faker.date.between(new Date(), new Date());
resultDate = faker.date.recent();
resultDate = faker.date.recent(100);
resultDate = faker.date.soon();
resultDate = faker.date.soon(30);
resultStr = faker.date.month();
resultStr = faker.date.month({
abbr: true,
@@ -86,6 +86,9 @@ resultStr = faker.finance.currencyCode();
resultStr = faker.finance.currencyName();
resultStr = faker.finance.currencySymbol();
resultStr = faker.finance.bitcoinAddress();
resultStr = faker.finance.ethereumAddress();
resultStr = faker.finance.iban();
resultStr = faker.finance.iban(true);
resultStr = faker.finance.bic();
resultStr = faker.hacker.abbreviation();
@@ -96,7 +99,7 @@ resultStr = faker.hacker.ingverb();
resultStr = faker.hacker.phrase();
resultStr = faker.helpers.randomize();
resultNum = faker.helpers.randomize([1,2,3,4]);
resultNum = faker.helpers.randomize([1, 2, 3, 4]);
resultStr = faker.helpers.randomize(['foo', 'bar', 'quux']);
resultStr = faker.helpers.slugify('foo bar quux');
resultStr = faker.helpers.replaceSymbolWithNumber('foo# bar#');
@@ -167,7 +170,6 @@ resultStr = faker.name.jobType();
resultStr = faker.phone.phoneNumber();
resultStr = faker.phone.phoneNumber('#');
resultStr = faker.phone.phoneNumberFormat();
// https://github.com/Marak/faker.js/blob/master/lib/phone_number.js#L9-L13
resultStr = faker.phone.phoneNumberFormat(0);
resultStr = faker.phone.phoneFormats();
@@ -179,27 +181,104 @@ resultNum = faker.random.number({
precision: 0
});
resultStr = faker.random.arrayElement();
resultStr = faker.random.arrayElement(['foo', 'bar', 'quux'])
resultStr = faker.random.arrayElement(['foo', 'bar', 'quux']);
resultStr = faker.random.objectElement();
resultStr = faker.random.objectElement({foo: 'bar', field: 'foo'});
resultStr = faker.random.uuid();
resultBool = faker.random.boolean();
resultStr = faker.random.word();
resultStr = faker.random.word("noun");
resultStr = faker.random.words();
resultStr = faker.random.words(0);
resultStr = faker.random.image();
resultStr = faker.random.locale();
resultStr = faker.random.alphaNumeric();
resultStr = faker.random.alphaNumeric(0);
resultStr = faker.random.hexaDecimal();
resultStr = faker.random.hexaDecimal(3);
resultStr = faker.system.fileName( "foo", "bar" );
resultStr = faker.system.commonFileName( "foo", "bar" );
resultStr = faker.system.fileName("foo", "bar");
resultStr = faker.system.commonFileName("foo", "bar");
resultStr = faker.system.mimeType();
resultStr = faker.system.commonFileType();
resultStr = faker.system.commonFileExt();
resultStr = faker.system.fileType();
resultStr = faker.system.fileExt( "foo" );
resultStr = faker.system.fileExt("foo");
resultStr = faker.system.directoryPath();
resultStr = faker.system.filePath();
resultStr = faker.system.semver();
import fakerAz = require('faker/locale/az');
resultStr = fakerAz.name.firstName();
import fakerCz = require('faker/locale/cz');
resultStr = fakerCz.name.firstName();
import fakerDe = require('faker/locale/de');
resultStr = fakerDe.name.firstName();
import fakerDeAT = require('faker/locale/de_AT');
resultStr = fakerDeAT.name.firstName();
import fakerdeCH = require('faker/locale/de_CH');
resultStr = fakerdeCH.name.firstName();
import fakerEn = require('faker/locale/en');
resultStr = faker.name.firstName();
resultStr = fakerEn.name.firstName();
import fakerEnAU = require('faker/locale/en_AU');
resultStr = fakerEnAU.name.firstName();
import fakerEnBORK = require('faker/locale/en_BORK');
resultStr = fakerEnBORK.name.firstName();
import fakerEnCA = require('faker/locale/en_CA');
resultStr = fakerEnCA.name.firstName();
import fakerEnGB = require('faker/locale/en_GB');
resultStr = fakerEnGB.name.firstName();
import fakerEnIE = require('faker/locale/en_IE');
resultStr = fakerEnIE.name.firstName();
import fakerEnIND = require('faker/locale/en_IND');
resultStr = fakerEnIND.name.firstName();
import fakerEnUS = require('faker/locale/en_US');
resultStr = fakerEnUS.name.firstName();
import fakerEnAuOcker = require('faker/locale/en_au_ocker');
resultStr = fakerEnAuOcker.name.firstName();
import fakerEs = require('faker/locale/es');
resultStr = fakerEs.name.firstName();
import fakerEsMX = require('faker/locale/es_MX');
resultStr = fakerEsMX.name.firstName();
import fakerFa = require('faker/locale/fa');
resultStr = fakerFa.name.firstName();
import fakerFr = require('faker/locale/fr');
resultStr = fakerFr.name.firstName();
import fakerFrCA = require('faker/locale/fr_CA');
resultStr = fakerFrCA.name.firstName();
import fakerGe = require('faker/locale/ge');
resultStr = fakerGe.name.firstName();
import fakerIdID = require('faker/locale/id_ID');
resultStr = fakerIdID.name.firstName();
import fakerIt = require('faker/locale/it');
resultStr = fakerIt.name.firstName();
import fakerJa = require('faker/locale/ja');
resultStr = fakerJa.name.firstName();
import fakerKo = require('faker/locale/ko');
resultStr = fakerKo.name.firstName();
import fakerNbNO = require('faker/locale/nb_NO');
resultStr = fakerNbNO.name.firstName();
import fakerNep = require('faker/locale/nep');
resultStr = fakerNep.name.firstName();
import fakerNl = require('faker/locale/nl');
resultStr = fakerNl.name.firstName();
import fakerPl = require('faker/locale/pl');
resultStr = fakerPl.name.firstName();
import fakerPtBR = require('faker/locale/pt_BR');
resultStr = fakerPtBR.name.firstName();
import fakerRu = require('faker/locale/ru');
resultStr = fakerRu.name.firstName();
import fakerSk = require('faker/locale/sk');
resultStr = fakerSk.name.firstName();
import fakerSv = require('faker/locale/sv');
resultStr = fakerSv.name.firstName();
import fakerTr = require('faker/locale/tr');
resultStr = fakerTr.name.firstName();
import fakerUk = require('faker/locale/uk');
resultStr = fakerUk.name.firstName();
import fakerVi = require('faker/locale/vi');
resultStr = fakerVi.name.firstName();
import fakerZhCN = require('faker/locale/zh_CN');
resultStr = fakerZhCN.name.firstName();
import fakerZhTW = require('faker/locale/zh_TW');
resultStr = fakerZhTW.name.firstName();
+18 -16
View File
@@ -1,9 +1,12 @@
// Type definitions for faker v4.1.0
// Type definitions for faker 4.1
// Project: http://marak.com/faker.js/
// Definitions by: Ben Swartz <https://github.com/bensw>, Bas Pennings <https://github.com/basp>, Yuki Kokubun <https://github.com/Kuniwak>
// Definitions by: Ben Swartz <https://github.com/bensw>,
// Bas Pennings <https://github.com/basp>,
// Yuki Kokubun <https://github.com/Kuniwak>,
// Matt Bishop <https://github.com/mattbishop>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare var fakerStatic: Faker.FakerStatic;
declare const fakerStatic: Faker.FakerStatic;
declare namespace Faker {
interface FakerStatic {
@@ -64,6 +67,7 @@ declare namespace Faker {
future(years?: number, refDate?: string|Date): Date;
between(from: string|number|Date, to: string|Date): Date;
recent(days?: number): Date;
soon(days?: number): Date;
month(options?: { abbr?: boolean, context?: boolean }): string;
weekday(options?: { abbr?: boolean, context?: boolean }): string;
};
@@ -74,12 +78,14 @@ declare namespace Faker {
account(length?: number): string;
accountName(): string;
mask(length?: number, parens?: boolean, elipsis?: boolean): string;
amount(min?:number, max?: number, dec?: number, symbol?: string): string;
amount(min?: number, max?: number, dec?: number, symbol?: string): string;
transactionType(): string;
currencyCode(): string;
currencyName(): string;
currencySymbol(): string;
bitcoinAddress(): string;
ethereumAddress(): string;
iban(formatted?: boolean): string
bic(): string
};
@@ -101,13 +107,12 @@ declare namespace Faker {
shuffle<T>(o: T[]): T[];
shuffle(): string[];
mustache(str: string, data: { [key: string]: string|((substring: string, ...args: any[]) => string) }): string;
createCard(): Faker.Card;
contextualCard(): Faker.ContextualCard;
userCard(): Faker.UserCard;
createTransaction(): Faker.Transaction;
createCard(): Card;
contextualCard(): ContextualCard;
userCard(): UserCard;
createTransaction(): Transaction;
};
image: {
image(): string;
avatar(): string;
@@ -186,11 +191,12 @@ declare namespace Faker {
objectElement<T>(object?: { [key: string]: T }, field?: any): T;
uuid(): string;
boolean(): boolean;
word(): string; // TODO: have ability to return specific type of word? As in: noun, adjective, verb, etc
word(type?: string): string;
words(count?: number): string;
image(): string;
locale(): string;
alphaNumeric(count?: number): string;
hexaDecimal(count?: number): string;
};
system: {
@@ -201,8 +207,8 @@ declare namespace Faker {
commonFileExt(): string;
fileType(): string;
fileExt(mimeType: string): string;
//directoryPath(): string;
//filePath(): string;
directoryPath(): string;
filePath(): string;
semver(): string;
};
@@ -315,10 +321,6 @@ declare module "faker/locale/de_CH" {
export = fakerStatic;
}
declare module "faker/locale/el_GR" {
export = fakerStatic;
}
declare module "faker/locale/en" {
export = fakerStatic;
}
+1 -1
View File
@@ -25,7 +25,7 @@ declare class FontFaceObserver {
* @param testString If your font doesn't contain latin characters you can pass a custom test string.
* @param timeout The default timeout for giving up on font loading is 3 seconds. You can increase or decrease this by passing a number of milliseconds.
*/
load(testString?: string, timeout?: number): Promise<void>;
load(testString?: string | null, timeout?: number): Promise<void>;
}
declare module "fontfaceobserver" {
+1 -1
View File
@@ -14,7 +14,7 @@ const fd = 0;
const modeNum = 0;
const modeStr = "";
const object = {};
const errorCallback = (err: Error | null) => { };
const errorCallback = (err: Error) => { };
const readOptions: fs.ReadOptions = {
reviver: {}
};
+74 -75
View File
@@ -14,142 +14,141 @@ import { Stats } from "fs";
export * from "fs";
export function copy(src: string, dest: string, options?: CopyOptions): Promise<void>;
export function copy(src: string, dest: string, callback: (err: Error | null) => void): void;
export function copy(src: string, dest: string, options: CopyOptions, callback: (err: Error | null) => void): void;
export function copy(src: string, dest: string, callback: (err: Error) => void): void;
export function copy(src: string, dest: string, options: CopyOptions, callback: (err: Error) => void): void;
export function copySync(src: string, dest: string, options?: CopyOptions): void;
export function move(src: string, dest: string, options?: MoveOptions): Promise<void>;
export function move(src: string, dest: string, callback: (err: Error | null) => void): void;
export function move(src: string, dest: string, options: MoveOptions, callback: (err: Error | null) => void): void;
export function move(src: string, dest: string, callback: (err: Error) => void): void;
export function move(src: string, dest: string, options: MoveOptions, callback: (err: Error) => void): void;
export function moveSync(src: string, dest: string, options?: MoveOptions): void;
export function createFile(file: string): Promise<void>;
export function createFile(file: string, callback: (err: Error | null) => void): void;
export function createFile(file: string, callback: (err: Error) => void): void;
export function createFileSync(file: string): void;
export function ensureDir(path: string): Promise<void>;
export function ensureDir(path: string, callback: (err: Error | null) => void): void;
export function ensureDir(path: string, callback: (err: Error) => void): void;
export function ensureDirSync(path: string): void;
export function mkdirs(dir: string): Promise<void>;
export function mkdirs(dir: string, callback: (err: Error | null) => void): void;
export function mkdirs(dir: string, callback: (err: Error) => void): void;
export function mkdirp(dir: string): Promise<void>;
export function mkdirp(dir: string, callback: (err: Error | null) => void): void;
export function mkdirp(dir: string, callback: (err: Error) => void): void;
export function mkdirsSync(dir: string): void;
export function mkdirpSync(dir: string): void;
export function outputFile(file: string, data: any, options?: WriteFileOptions | string): Promise<void>;
export function outputFile(file: string, data: any, callback: (err: Error | null) => void): void;
export function outputFile(file: string, data: any, options: WriteFileOptions | string, callback: (err: Error | null) => void): void;
export function outputFile(file: string, data: any, callback: (err: Error) => void): void;
export function outputFile(file: string, data: any, options: WriteFileOptions | string, callback: (err: Error) => void): void;
export function outputFileSync(file: string, data: any, options?: WriteFileOptions | string): void;
export function readJson(file: string, options?: ReadOptions): Promise<any>;
export function readJson(file: string, callback: (err: Error | null, jsonObject: any) => void): void;
export function readJson(file: string, options: ReadOptions, callback: (err: Error | null, jsonObject: any) => void): void;
export function readJson(file: string, callback: (err: Error, jsonObject: any) => void): void;
export function readJson(file: string, options: ReadOptions, callback: (err: Error, jsonObject: any) => void): void;
export function readJSON(file: string, options?: ReadOptions): Promise<any>;
export function readJSON(file: string, callback: (err: Error | null, jsonObject: any) => void): void;
export function readJSON(file: string, options: ReadOptions, callback: (err: Error | null, jsonObject: any) => void): void;
export function readJSON(file: string, callback: (err: Error, jsonObject: any) => void): void;
export function readJSON(file: string, options: ReadOptions, callback: (err: Error, jsonObject: any) => void): void;
export function readJsonSync(file: string, options?: ReadOptions): any;
export function readJSONSync(file: string, options?: ReadOptions): any;
export function remove(dir: string): Promise<void>;
export function remove(dir: string, callback: (err: Error | null) => void): void;
export function remove(dir: string, callback: (err: Error) => void): void;
export function removeSync(dir: string): void;
export function outputJSON(file: string, data: any, options?: WriteOptions): Promise<void>;
export function outputJSON(file: string, data: any, options: WriteOptions, callback: (err: Error | null) => void): void;
export function outputJSON(file: string, data: any, callback: (err: Error | null) => void): void;
export function outputJSON(file: string, data: any, options: WriteOptions, callback: (err: Error) => void): void;
export function outputJSON(file: string, data: any, callback: (err: Error) => void): void;
export function outputJson(file: string, data: any, options?: WriteOptions): Promise<void>;
export function outputJson(file: string, data: any, options: WriteOptions, callback: (err: Error | null) => void): void;
export function outputJson(file: string, data: any, callback: (err: Error | null) => void): void;
export function outputJson(file: string, data: any, options: WriteOptions, callback: (err: Error) => void): void;
export function outputJson(file: string, data: any, callback: (err: Error) => void): void;
export function outputJsonSync(file: string, data: any, options?: WriteOptions): void;
export function outputJSONSync(file: string, data: any, options?: WriteOptions): void;
export function writeJSON(file: string, object: any, options?: WriteOptions): Promise<void>;
export function writeJSON(file: string, object: any, callback: (err: Error | null) => void): void;
export function writeJSON(file: string, object: any, options: WriteOptions, callback: (err: Error | null) => void): void;
export function writeJSON(file: string, object: any, callback: (err: Error) => void): void;
export function writeJSON(file: string, object: any, options: WriteOptions, callback: (err: Error) => void): void;
export function writeJson(file: string, object: any, options?: WriteOptions): Promise<void>;
export function writeJson(file: string, object: any, callback: (err: Error | null) => void): void;
export function writeJson(file: string, object: any, options: WriteOptions, callback: (err: Error | null) => void): void;
export function writeJson(file: string, object: any, callback: (err: Error) => void): void;
export function writeJson(file: string, object: any, options: WriteOptions, callback: (err: Error) => void): void;
export function writeJsonSync(file: string, object: any, options?: WriteOptions): void;
export function writeJSONSync(file: string, object: any, options?: WriteOptions): void;
export function ensureFile(path: string): Promise<void>;
export function ensureFile(path: string, callback: (err: Error | null) => void): void;
export function ensureFile(path: string, callback: (err: Error) => void): void;
export function ensureFileSync(path: string): void;
export function ensureLink(src: string, dest: string): Promise<void>;
export function ensureLink(src: string, dest: string, callback: (err: Error | null) => void): void;
export function ensureLink(src: string, dest: string, callback: (err: Error) => void): void;
export function ensureLinkSync(src: string, dest: string): void;
export function ensureSymlink(src: string, dest: string, type?: SymlinkType): Promise<void>;
export function ensureSymlink(src: string, dest: string, type: SymlinkType, callback: (err: Error | null) => void): void;
export function ensureSymlink(src: string, dest: string, callback: (err: Error | null) => void): void;
export function ensureSymlink(src: string, dest: string, type: SymlinkType, callback: (err: Error) => void): void;
export function ensureSymlink(src: string, dest: string, callback: (err: Error) => void): void;
export function ensureSymlinkSync(src: string, dest: string, type?: SymlinkType): void;
export function emptyDir(path: string): Promise<void>;
export function emptyDir(path: string, callback: (err: Error | null) => void): void;
export function emptyDir(path: string, callback: (err: Error) => void): void;
export function emptyDirSync(path: string): void;
export function pathExists(path: string): Promise<boolean>;
export function pathExists(path: string, callback: (err: Error | null, exists: boolean) => void): void;
export function pathExists(path: string, callback: (err: Error, exists: boolean) => void): void;
export function pathExistsSync(path: string): boolean;
// fs async methods
// copied from https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/types/node/v6/index.d.ts
/** Tests a user's permissions for the file specified by path. */
export function access(path: string | Buffer, callback: (err: NodeJS.ErrnoException | null) => void): void;
export function access(path: string | Buffer, mode: number, callback: (err: NodeJS.ErrnoException | null) => void): void;
export function access(path: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void;
export function access(path: string | Buffer, mode: number, callback: (err: NodeJS.ErrnoException) => void): void;
export function access(path: string | Buffer, mode?: number): Promise<void>;
export function appendFile(file: string | Buffer | number, data: any, options: { encoding?: string; mode?: number | string; flag?: string; },
callback: (err: NodeJS.ErrnoException | null) => void): void;
export function appendFile(file: string | Buffer | number, data: any, callback: (err: NodeJS.ErrnoException | null) => void): void;
callback: (err: NodeJS.ErrnoException) => void): void;
export function appendFile(file: string | Buffer | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void;
export function appendFile(file: string | Buffer | number, data: any, options?: { encoding?: string; mode?: number | string; flag?: string; }): Promise<void>;
export function chmod(path: string | Buffer, mode: string | number, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function chmod(path: string | Buffer, mode: string | number, callback: (err: NodeJS.ErrnoException) => void): void;
export function chmod(path: string | Buffer, mode: string | number): Promise<void>;
export function chown(path: string | Buffer, uid: number, gid: number): Promise<void>;
export function chown(path: string | Buffer, uid: number, gid: number, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function chown(path: string | Buffer, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void;
export function close(fd: number, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function close(fd: number, callback: (err: NodeJS.ErrnoException) => void): void;
export function close(fd: number): Promise<void>;
export function fchmod(fd: number, mode: string | number, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function fchmod(fd: number, mode: string | number, callback: (err: NodeJS.ErrnoException) => void): void;
export function fchmod(fd: number, mode: string | number): Promise<void>;
export function fchown(fd: number, uid: number, gid: number, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function fchown(fd: number, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void;
export function fchown(fd: number, uid: number, gid: number): Promise<void>;
export function fdatasync(fd: number, callback: () => void): void;
export function fdatasync(fd: number): Promise<void>;
export function fstat(fd: number, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any): void;
export function fstat(fd: number, callback: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
export function fstat(fd: number): Promise<Stats>;
export function fsync(fd: number, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function fsync(fd: number, callback: (err: NodeJS.ErrnoException) => void): void;
export function fsync(fd: number): Promise<void>;
export function ftruncate(fd: number, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function ftruncate(fd: number, len: number, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function ftruncate(fd: number, callback: (err: NodeJS.ErrnoException) => void): void;
export function ftruncate(fd: number, len: number, callback: (err: NodeJS.ErrnoException) => void): void;
export function ftruncate(fd: number, len?: number): Promise<void>;
export function futimes(fd: number, atime: number, mtime: number, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function futimes(fd: number, atime: Date, mtime: Date, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function futimes(fd: number, atime: number, mtime: number, callback: (err: NodeJS.ErrnoException) => void): void;
export function futimes(fd: number, atime: Date, mtime: Date, callback: (err: NodeJS.ErrnoException) => void): void;
export function futimes(fd: number, atime: number, mtime: number): Promise<void>;
export function futimes(fd: number, atime: Date, mtime: Date): Promise<void>;
export function lchown(path: string | Buffer, uid: number, gid: number, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function lchown(path: string | Buffer, uid: number, gid: number, callback: (err: NodeJS.ErrnoException) => void): void;
export function lchown(path: string | Buffer, uid: number, gid: number): Promise<void>;
export function link(srcpath: string | Buffer, dstpath: string | Buffer, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function link(srcpath: string | Buffer, dstpath: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void;
export function link(srcpath: string | Buffer, dstpath: string | Buffer): Promise<void>;
export function lstat(path: string | Buffer, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any): void;
export function lstat(path: string | Buffer, callback: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
export function lstat(path: string | Buffer): Promise<Stats>;
/**
@@ -157,42 +156,42 @@ export function lstat(path: string | Buffer): Promise<Stats>;
*
* @param callback No arguments other than a possible exception are given to the completion callback.
*/
export function mkdir(path: string | Buffer, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function mkdir(path: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void;
/**
* Asynchronous mkdir - creates the directory specified in {path}. Parameter {mode} defaults to 0777.
*
* @param callback No arguments other than a possible exception are given to the completion callback.
*/
export function mkdir(path: string | Buffer, mode: number | string, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function mkdir(path: string | Buffer, mode: number | string, callback: (err: NodeJS.ErrnoException) => void): void;
export function mkdir(path: string | Buffer): Promise<void>;
export function open(path: string | Buffer, flags: string | number, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
export function open(path: string | Buffer, flags: string | number, mode: number, callback: (err: NodeJS.ErrnoException | null, fd: number) => void): void;
export function open(path: string | Buffer, flags: string | number, callback: (err: NodeJS.ErrnoException, fd: number) => void): void;
export function open(path: string | Buffer, flags: string | number, mode: number, callback: (err: NodeJS.ErrnoException, fd: number) => void): void;
export function open(path: string | Buffer, flags: string | number, mode?: number): Promise<number>;
export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number | null,
callback: (err: NodeJS.ErrnoException | null, bytesRead: number, buffer: Buffer) => void): void;
callback: (err: NodeJS.ErrnoException, bytesRead: number, buffer: Buffer) => void): void;
export function read(fd: number, buffer: Buffer, offset: number, length: number, position: number | null): Promise<ReadResult>;
export function readFile(file: string | Buffer | number, callback: (err: NodeJS.ErrnoException | null, data: Buffer) => void): void;
export function readFile(file: string | Buffer | number, encoding: string, callback: (err: NodeJS.ErrnoException | null, data: string) => void): void;
export function readFile(file: string | Buffer | number, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
export function readFile(file: string | Buffer | number, encoding: string, callback: (err: NodeJS.ErrnoException, data: string) => void): void;
export function readFile(file: string | Buffer | number, options: { flag?: string; } | { encoding: string; flag?: string; }, callback: (err: NodeJS.ErrnoException, data: Buffer) => void): void;
export function readFile(file: string | Buffer | number, options: { flag?: string; } | { encoding: string; flag?: string; }): Promise<string>;
// tslint:disable-next-line:unified-signatures
export function readFile(file: string | Buffer | number, encoding: string): Promise<string>;
export function readFile(file: string | Buffer | number): Promise<Buffer>;
export function readdir(path: string | Buffer, callback: (err: NodeJS.ErrnoException | null, files: string[]) => void): void;
export function readdir(path: string | Buffer, callback: (err: NodeJS.ErrnoException, files: string[]) => void): void;
export function readdir(path: string | Buffer): Promise<string[]>;
export function readlink(path: string | Buffer, callback: (err: NodeJS.ErrnoException | null, linkString: string) => any): void;
export function readlink(path: string | Buffer, callback: (err: NodeJS.ErrnoException, linkString: string) => any): void;
export function readlink(path: string | Buffer): Promise<string>;
export function realpath(path: string | Buffer, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => any): void;
export function realpath(path: string | Buffer, cache: { [path: string]: string }, callback: (err: NodeJS.ErrnoException | null, resolvedPath: string) => any): void;
export function realpath(path: string | Buffer, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void;
export function realpath(path: string | Buffer, cache: { [path: string]: string }, callback: (err: NodeJS.ErrnoException, resolvedPath: string) => any): void;
export function realpath(path: string | Buffer, cache?: { [path: string]: string }): Promise<string>;
export function rename(oldPath: string, newPath: string, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function rename(oldPath: string, newPath: string, callback: (err: NodeJS.ErrnoException) => void): void;
export function rename(oldPath: string, newPath: string): Promise<void>;
/**
@@ -200,17 +199,17 @@ export function rename(oldPath: string, newPath: string): Promise<void>;
*
* @param callback No arguments other than a possible exception are given to the completion callback.
*/
export function rmdir(path: string | Buffer, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function rmdir(path: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void;
export function rmdir(path: string | Buffer): Promise<void>;
export function stat(path: string | Buffer, callback: (err: NodeJS.ErrnoException | null, stats: Stats) => any): void;
export function stat(path: string | Buffer, callback: (err: NodeJS.ErrnoException, stats: Stats) => any): void;
export function stat(path: string | Buffer): Promise<Stats>;
export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, type: string, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, type: string, callback: (err: NodeJS.ErrnoException) => void): void;
export function symlink(srcpath: string | Buffer, dstpath: string | Buffer, type?: string): Promise<void>;
export function truncate(path: string | Buffer, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function truncate(path: string | Buffer, len: number, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function truncate(path: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void;
export function truncate(path: string | Buffer, len: number, callback: (err: NodeJS.ErrnoException) => void): void;
export function truncate(path: string | Buffer, len?: number): Promise<void>;
/**
@@ -218,25 +217,25 @@ export function truncate(path: string | Buffer, len?: number): Promise<void>;
*
* @param callback No arguments other than a possible exception are given to the completion callback.
*/
export function unlink(path: string | Buffer, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function unlink(path: string | Buffer, callback: (err: NodeJS.ErrnoException) => void): void;
export function unlink(path: string | Buffer): Promise<void>;
export function utimes(path: string | Buffer, atime: number, mtime: number, callback: (err?: NodeJS.ErrnoException) => void): void;
export function utimes(path: string | Buffer, atime: Date, mtime: Date, callback: (err?: NodeJS.ErrnoException | null) => void): void;
export function utimes(path: string | Buffer, atime: number, mtime: number, callback: (err: NodeJS.ErrnoException) => void): void;
export function utimes(path: string | Buffer, atime: Date, mtime: Date, callback: (err: NodeJS.ErrnoException) => void): void;
export function utimes(path: string | Buffer, atime: number, mtime: number): Promise<void>;
export function utimes(path: string | Buffer, atime: Date, mtime: Date): Promise<void>;
export function write(fd: number, buffer: Buffer, offset: number, length: number, position: number | null, callback: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void;
export function write(fd: number, buffer: Buffer, offset: number, length: number, callback: (err: NodeJS.ErrnoException | null, written: number, buffer: Buffer) => void): void;
export function write(fd: number, data: any, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void;
export function write(fd: number, data: any, offset: number, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void;
export function write(fd: number, data: any, offset: number, encoding: string, callback: (err: NodeJS.ErrnoException | null, written: number, str: string) => void): void;
export function write(fd: number, buffer: Buffer, offset: number, length: number, callback: (err: NodeJS.ErrnoException, written: number, buffer: Buffer) => void): void;
export function write(fd: number, data: any, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void;
export function write(fd: number, data: any, offset: number, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void;
export function write(fd: number, data: any, offset: number, encoding: string, callback: (err: NodeJS.ErrnoException, written: number, str: string) => void): void;
export function write(fd: number, buffer: Buffer, offset: number, length: number, position?: number | null): Promise<WriteResult>;
export function write(fd: number, data: any, offset: number, encoding?: string): Promise<WriteResult>;
export function writeFile(file: string | Buffer | number, data: any, callback: (err: NodeJS.ErrnoException | null) => void): void;
export function writeFile(file: string | Buffer | number, data: any, callback: (err: NodeJS.ErrnoException) => void): void;
export function writeFile(file: string | Buffer | number, data: any, options?: WriteFileOptions | string): Promise<void>;
export function writeFile(file: string | Buffer | number, data: any, options: WriteFileOptions | string, callback: (err: NodeJS.ErrnoException | null) => void): void;
export function writeFile(file: string | Buffer | number, data: any, options: WriteFileOptions | string, callback: (err: NodeJS.ErrnoException) => void): void;
/**
* Asynchronous mkdtemp - Creates a unique temporary directory. Generates six random characters to be appended behind a required prefix to create a unique temporary directory.
@@ -244,7 +243,7 @@ export function writeFile(file: string | Buffer | number, data: any, options: Wr
* @param callback The created folder path is passed as a string to the callback's second parameter.
*/
export function mkdtemp(prefix: string): Promise<string>;
export function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException | null, folder: string) => void): void;
export function mkdtemp(prefix: string, callback: (err: NodeJS.ErrnoException, folder: string) => void): void;
export interface PathEntry {
path: string;
+4
View File
@@ -0,0 +1,4 @@
import globParent = require('glob-parent');
// $ExpectType string
globParent('*.js');
+8
View File
@@ -0,0 +1,8 @@
// Type definitions for glob-parent 3.1
// Project: https://github.com/es128/glob-parent
// Definitions by: mrmlnc <https://github.com/mrmlnc>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function globParent(pattern: string): string;
export = globParent;
+23
View File
@@ -0,0 +1,23 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"glob-parent-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+657
View File
@@ -0,0 +1,657 @@
// Type definitions for Google Apps Script 2017-10-30
// Project: https://developers.google.com/apps-script/
// Definitions by: dhayab <https://github.com/dhayab/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
/// <reference path="google-apps-script.gmail.d.ts" />
declare namespace GoogleAppsScript {
export module Card {
export interface Action {
/**
* Sets the name of the callback function to be called.
*/
setFunctionName(functionName: string): Action;
/**
* Sets the loading indicator that displays while the action is in progress.
*/
setLoadIndicator(loadIndicator: LoadIndicator): Action;
/**
* Allows custom parameters to be passed to the callback function.
*/
setParameters(parameters: { [key: string]: string }): Action;
}
export interface ActionEvent {
messageMetadata: {
/**
* An access token. You can use this to enable access to user data using temporary Gmail add-on scopes.
*/
accessToken: string;
/**
* The message ID of the thread open in the Gmail UI.
*/
messageId: string;
}
/**
* Indicates where the event originates (web, iOS, or Android).
*/
clientPlatform: string;
/**
* The current values of all form widgets in the card, restricted to one value per widget. The keys are the string IDs associated with the widgets.
*
* The event object provides `formInput` as a convenience for when you need to read data from multiple widgets with expected singular values, such as text inputs and switches.
*
* For multi-valued widgets such as checkboxes, you can read each value from `formInputs` instead.
*/
formInput: { [key: string]: string };
/**
* The current values of widgets in the card, presented in arrays. The keys are the string IDs associated with the widget.
*
* For single-valued widgets, the value is presented in a single-element array. For multi-valued widgets such as checkboxes, all the values are presented in an array.
*/
formInputs: { [key: string]: string[] };
/**
* Any additional parameters you supply to the `Action` using `Action.setParameters()`.
*/
parameters: { [key: string]: string };
}
export interface ActionResponse {
/**
* Prints the JSON representation of this object.
*/
printJson(): string;
}
export interface ActionResponseBuilder {
/**
* Builds the current action response and validates it.
*/
build(): ActionResponse;
/**
* Sets the response to `Navigation` action.
*/
setNavigation(navigation: Navigation): ActionResponseBuilder;
/**
* Sets the notification to display when the action is activated.
*/
setNotification(notification: Notification): ActionResponseBuilder;
/**
* Sets the URL to navigate to when the action is activated.
*/
setOpenLink(openLink: OpenLink): ActionResponseBuilder;
}
export interface AuthorizationAction {
/**
* Sets the authorization URL that user is taken to from the authorization prompt.
*/
setAuthorizationUrl(authorizationUrl: string): AuthorizationAction;
}
export interface AuthorizationException {
/**
* Prints the JSON representation of this object.
*/
printJson(): string;
/**
* Sets the authorization URL that user is taken to from the authorization prompt.
*/
setAuthorizationUrl(authUrl: string): AuthorizationException;
/**
* The name of a function to call to generate a custom authorization prompt.
*/
setCustomUiCallback(callback: string): AuthorizationException;
/**
* Sets the name that is displayed to the user when asking for authorization.
*/
setResourceDisplayName(name: string): AuthorizationException;
/**
* Triggers this exception to be thrown.
*/
throwException(): void;
}
interface Button<T> extends Widget {
/**
* Sets an authorization action that opens a URL to the authorization flow when the object is clicked.
*/
setAuthorizationAction(action: AuthorizationAction): T;
/**
* Sets an action that composes a draft email when the object is clicked.
*/
setComposeAction(action: Action, composedEmailType: ComposedEmailType): T;
/**
* Sets an action that executes when the object is clicked.
*/
setOnClickAction(action: Action): T;
/**
* Sets an action that opens a URL in a tab when the object is clicked.
*/
setOnClickOpenLinkAction(action: Action): T;
/**
* Sets a URL to be opened when the object is clicked.
*/
setOpenLink(openLink: OpenLink): T;
}
export interface ButtonSet extends Widget {
/**
* Adds a button.
*/
addButton(button: Button<ImageButton | TextButton>): ButtonSet;
}
export interface Card {
/**
* Prints the JSON representation of this object.
*/
printJson(): string;
}
export interface CardAction extends Button<CardAction> {
/**
* Sets the menu text for this action.
*/
setText(text: string): CardAction;
}
export interface CardBuilder {
/**
* Adds a CardAction to this Card.
*/
addCardAction(cardAction: CardAction): CardBuilder;
/**
* Adds a section to this card.
*/
addSection(section: CardSection): CardBuilder;
/**
* Builds the current card and validates it.
*/
build(): Card;
/**
* Sets the header for this card.
*/
setHeader(cardHeader: CardHeader): CardBuilder;
/**
* Sets the name for this card.
*/
setName(name: string): CardBuilder;
}
export interface CardHeader {
/**
* Sets the alternative text for the header image.
*/
setImageAltText(imageAltText: string): CardHeader;
/**
* Sets the cropping of the icon in the card header.
*/
setImageStyle(imageStyle: ImageStyle): CardHeader;
/**
* Sets the image to use in the header by providing its URL.
*/
setImageUrl(imageUrl: string): CardHeader;
/**
* Sets the subtitle of the card header.
*/
setSubtitle(subtitle: string): CardHeader;
/**
* Sets the title of the card header.
*/
setTitle(title: string): CardHeader;
}
export interface CardSection {
/**
* Adds the given widget to this section.
*/
addWidget(widget: Widget): CardSection;
/**
* Sets whether the section can be collapsed.
*/
setCollapsible(collapsible: boolean): CardSection;
/**
* Sets the header of the section.
*/
setHeader(header: string): CardSection;
/**
* Sets the number of widgets that are still shown when this section is collapsed.
*/
setNumUncollapsibleWidgets(numUncollapsibleWidgets: Integer): CardSection;
}
export interface CardService {
/**
* Specifies whether the composed email is a standalone or reply draft.
*/
ComposedEmailType: typeof ComposedEmailType;
/**
* Predefined icons that can be used in various UI objects, such as ImageButton or KeyValue widgets.
*/
Icon: typeof Icon;
/**
* Defines an image cropping style.
*/
ImageStyle: typeof ImageStyle;
/**
* Specifies the type of loading or progress indicator to display while an Action is being processed.
*/
LoadIndicator: typeof LoadIndicator;
/**
* Type of notification to show.
*/
NotificationType: typeof NotificationType;
/**
* Specifies what to do when a URL opened through an OpenLink is closed.
*
* When a link is opened, the client either forgets about it or waits until the window is closed. The implementation depends on the client platform capabilities. OnClose may cause OpenAs to be ignored; if the client platform cannot support both selected values together, OnClose takes precedence.
*/
OnClose: typeof OnClose;
/**
* Specifies how to open a URL.
*
* The client can open a URL as either a full size window (if that is the frame used by the client), or an overlay (such as a pop-up). The implementation depends on the client platform capabilities, and the value selected may be ignored if the client does not support it. FULL_SIZE is supported by all clients.
*
* Using OnClose may cause OpenAs to be ignored; if the client platform cannot support both selected values together, OnClose takes precedence.
*/
OpenAs: typeof OpenAs;
/**
* Type of selection input.
*/
SelectionInputType: typeof SelectionInputType;
/**
* Creates a new `Action`.
*/
newAction(): Action;
/**
* Creates a new `ActionResponseBuilder`.
*/
newActionResponseBuilder(): ActionResponseBuilder;
/**
* Creates a new `AuthorizationAction`.
*/
newAuthorizationAction(): AuthorizationAction;
/**
* Creates a new `AuthorizationException`.
*/
newAuthorizationException(): AuthorizationException;
/**
* Creates a new `ButtonSet`.
*/
newButtonSet(): ButtonSet;
/**
* Creates a new `CardAction`.
*/
newCardAction(): CardAction;
/**
* Creates a new `CardBuilder`.
*/
newCardBuilder(): CardBuilder;
/**
* Creates a new `CardHeader`.
*/
newCardHeader(): CardHeader;
/**
* Creates a new `CardSection`.
*/
newCardSection(): CardSection;
/**
* Creates a new `ComposeActionResponseBuilder`.
*/
newComposeActionResponseBuilder(): ComposeActionResponseBuilder;
/**
* Creates a new `Image`.
*/
newImage(): Image;
/**
* Creates a new `ImageButton`.
*/
newImageButton(): ImageButton;
/**
* Creates a new `KeyValue`.
*/
newKeyValue(): KeyValue;
/**
* Creates a new `Navigation`.
*/
newNavigation(): Navigation;
/**
* Creates a new `Notification`.
*/
newNotification(): Notification;
/**
* Creates a new `OpenLink`.
*/
newOpenLink(): OpenLink;
/**
* Creates a new `SelectionInput`.
*/
newSelectionInput(): SelectionInput;
/**
* Creates a new `Suggestions`.
*/
newSuggestions(): Suggestions;
/**
* Creates a new `SuggestionsResponseBuilder`.
*/
newSuggestionsResponseBuilder(): SuggestionsResponseBuilder;
/**
* Creates a new `Switch`.
*/
newSwitch(): Switch;
/**
* Creates a new `TextButton`.
*/
newTextButton(): TextButton;
/**
* Creates a new `TextInput`.
*/
newTextInput(): TextInput;
/**
* Creates a new `TextParagraph`.
*/
newTextParagraph(): TextParagraph;
/**
* Creates a new `UniversalActionResponseBuilder`.
*/
newUniversalActionResponseBuilder(): UniversalActionResponseBuilder;
}
export interface ComposeActionResponse {
/**
* Prints the JSON representation of this object.
*/
printJson(): string;
}
export interface ComposeActionResponseBuilder {
/**
* Builds the current compose action response and validates it.
*/
build(): ComposeActionResponse;
/**
* Sets the draft `GmailMessage` created using `GmailMessage.createDraftReply(body)` or similar functions.
*/
setGmailDraft(draft: Gmail.GmailDraft): ComposeActionResponseBuilder;
}
export interface Image extends Button<Image> {
/**
* Sets the alternative text of the image for accessibility.
*/
setAltText(altText: string): Image;
/**
* Sets the URL of the image.
*/
setImageUrl(url: string): Image;
}
export interface ImageButton extends Button<ImageButton> {
/**
* Sets the alternative text of the button for accessibility.
*/
setAltText(altText: string): ImageButton;
/**
* Sets a predefined Icon to display on the button.
*/
setIcon(icon: Icon): ImageButton;
/**
* Sets the URL of an image to use as this button's icon.
*/
setIconUrl(url: string): ImageButton;
}
export interface KeyValue extends Button<KeyValue> {
/**
* Sets the label text to be used as the key.
*/
setBottomLabel(text: string): KeyValue;
/**
* Sets the Button that is displayed to the right of the context.
*/
setButton(button: Button<ImageButton | TextButton>): KeyValue;
/**
* Sets the text to be used as the value.
*/
setContent(text: string): KeyValue;
/**
* Sets the icon to be used as the key.
*/
setIcon(icon: Icon): KeyValue;
/**
* Sets the alternative text for the icon.
*/
setIconAltText(altText: string): KeyValue;
/**
* Sets the URL of the icon to be used as the key.
*/
setIconUrl(url: string): KeyValue;
/**
* Sets whether the value text should be displayed on a single line or multiple lines.
*/
setMultiline(multiline: boolean): KeyValue;
/**
* Sets the Switch that is displayed to the right of the content.
*/
setSwitch(switchToSet: Switch): KeyValue;
/**
* Sets the label text to be used as the key.
*/
setTopLabel(text: string): KeyValue;
}
export interface Navigation {
/**
* Pops a card from the navigation stack.
*/
popCard(): Navigation;
/**
* Pops to the specified card by its card name.
*/
popToNamedCard(cardName: string): Navigation;
/**
* Pops the card stack to the root card.
*/
popToRoot(): Navigation;
/**
* Prints the JSON representation of this object.
*/
printJson(): string;
/**
* Pushes the given card onto the stack.
*/
pushCard(card: Card): Navigation;
/**
* Does an in-place replacement of the current card.
*/
updateCard(card: Card): Navigation;
}
export interface Notification {
/**
* Sets the text to show in the notification.
*/
setText(text: string): Notification;
/**
* Sets the notification type to show.
*/
setType(type: NotificationType): Notification;
}
export interface OpenLink {
/**
* Sets the behavior of the URL action when the URL window or tab is closed.
*/
setOnClose(onClose: OnClose): OpenLink;
/**
* Sets the behavior of URL when it is opened.
*/
setOpenAs(openAs: OpenAs): OpenLink;
/**
* Sets the URL to be opened.
*/
setUrl(url: string): OpenLink;
}
export interface SelectionInput extends Widget {
/**
* Adds a new item that can be selected.
*/
addItem(text: Object, value: Object, selected: boolean): SelectionInput;
/**
* Sets the key that identifies this selection input in the event object that is generated when there is a UI interaction.
*/
setFieldName(fieldName: string): SelectionInput;
/**
* Sets an Action to be performed whenever the selection input changes.
*/
setOnChangeAction(action: Action): SelectionInput;
/**
* Sets the title to be shown ahead of the input field.
*/
setTitle(title: string): SelectionInput;
/**
* Sets the type of this input.
*/
setType(type: SelectionInputType): SelectionInput;
}
export interface Suggestions {
/**
* Add a text suggestion.
*/
addSuggestion(suggestion: string): Suggestions;
/**
* Add a list of text suggestions.
*/
addSuggestions(suggestions: string[]): Suggestions;
}
export interface SuggestionsResponse {
/**
* Prints the JSON representation of this object.
*/
printJson(): string;
}
export interface SuggestionsResponseBuilder {
/**
* Builds the current suggestions response and validates it.
*/
build(): SuggestionsResponse;
/**
* Sets the suggestions used in auto complete in text fields.
*/
setSuggestions(suggestions: Suggestions): SuggestionsResponseBuilder;
}
export interface Switch extends Widget {
/**
* Sets the key that identified this switch in the event object that is generated when there is a UI interaction.
*/
setFieldName(fieldName: string): Switch;
/**
* Sets the action to take when the switch is toggled.
*/
setOnChangeAction(action: Action): Switch;
/**
* Sets whether this switch should start as selected or unselected.
*/
setSelected(selected: boolean): Switch;
/**
* Sets the value that is sent as the form input when this switch is toggled on.
*/
setValue(value: string): Switch;
}
export interface TextButton extends Button<TextButton> {
/**
* Sets the text to be displayed on the button.
*/
setText(text: string): TextButton;
}
export interface TextInput extends Widget {
/**
* Sets the key that identifies this text input in the event object that is generated when there is a UI interaction.
*/
setFieldName(fieldName: string): TextInput;
/**
* Sets a hint for the text input.
*/
setHint(hint: string): TextInput;
/**
* Sets whether the input text shows on one line or multiple lines.
*/
setMultiline(multiline: boolean): TextInput;
/**
* Sets an action to be performed whenever the text input changes.
*/
setOnChangeAction(action: Action): TextInput;
/**
* Sets the suggestions for autocompletion in the text field.
*/
setSuggestions(suggestions: Suggestions): TextInput;
/**
* Sets the callback action to fetch suggestions based on user input for autocompletion.
*/
setSuggestionsAction(suggestionsAction: Action): TextInput
/**
* Sets the title to be shown above the input field.
*/
setTitle(title: string): TextInput;
/**
* Sets the pre-filled value to be set in the input field.
*/
setValue(value: string): TextInput;
}
export interface TextParagraph extends Widget {
/**
* Sets the text of the paragraph.
*/
setText(text: string): TextParagraph;
}
export interface UniversalActionResponse {
/**
* Prints the JSON representation of this object.
*/
printJson(): string;
}
export interface UniversalActionResponseBuilder {
/**
* Builds the current universal action response and validates it.
*/
build(): UniversalActionResponse;
/**
* Displays the add-on with the specified cards.
*/
displayAddOnCards(cardObjects: Card[]): UniversalActionResponseBuilder;
/**
* Sets the URL to open when the universal action is selected.
*/
setOpenLink(openLink: OpenLink): UniversalActionResponseBuilder;
}
export interface Widget { }
export enum ComposedEmailType { REPLY_AS_DRAFT, STANDALONE_DRAFT }
export enum Icon { NONE, AIRPLANE, BOOKMARK, BUS, CAR, CLOCK, CONFIRMATION_NUMBER_ICON, DOLLAR, DESCRIPTION, EMAIL, EVENT_PERFORMER, EVENT_SEAT, FLIGHT_ARRIVAL, FLIGHT_DEPARTURE, HOTEL, HOTEL_ROOM_TYPE, INVITE, MAP_PIN, MEMBERSHIP, MULTIPLE_PEOPLE, OFFER, PERSON, PHONE, RESTAURANT_ICON, SHOPPING_CART, STAR, STORE, TICKET, TRAIN, VIDEO_CAMERA, VIDEO_PLAY }
export enum ImageStyle { SQUARE, CIRCLE }
export enum LoadIndicator { SPINNER, NONE }
export enum NotificationType { INFO, ERROR, WARNING }
export enum OnClose { NOTHING, RELOAD_ADD_ON }
export enum OpenAs { FULL_SIZE, OVERLAY }
export enum SelectionInputType { CHECK_BOX, RADIO_BUTTON, DROPDOWN }
}
}
/**
* CardService provides the ability to create generic cards used across different Google extensibility products, such as [Gmail add-ons](https://developers.google.com/gmail/add-ons).
*/
declare var CardService: GoogleAppsScript.Card.CardService;
+80
View File
@@ -1,6 +1,7 @@
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// dhayab <https://github.com/dhayab/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
@@ -12,12 +13,16 @@ declare namespace GoogleAppsScript {
* Provides access to Gmail threads, messages, and labels.
*/
export interface GmailApp {
createDraft(recipient: string, subject: string, body: string): GmailDraft;
createDraft(recipient: string, subject: string, body: string, options: GmailDraftOptions): GmailDraft;
createLabel(name: string): GmailLabel;
deleteLabel(label: GmailLabel): GmailApp;
getAliases(): string[];
getChatThreads(): GmailThread[];
getChatThreads(start: Integer, max: Integer): GmailThread[];
getDraft(draftId: string): GmailDraft;
getDraftMessages(): GmailMessage[];
getDrafts(): GmailDraft[];
getInboxThreads(): GmailThread[];
getInboxThreads(start: Integer, max: Integer): GmailThread[];
getInboxUnreadCount(): Integer;
@@ -68,6 +73,7 @@ declare namespace GoogleAppsScript {
search(query: string, start: Integer, max: Integer): GmailThread[];
sendEmail(recipient: string, subject: string, body: string): GmailApp;
sendEmail(recipient: string, subject: string, body: string, options: Object): GmailApp;
setCurrentMessageAccessToken(accessToken: string): void;
starMessage(message: GmailMessage): GmailApp;
starMessages(messages: GmailMessage[]): GmailApp;
unstarMessage(message: GmailMessage): GmailApp;
@@ -112,6 +118,72 @@ declare namespace GoogleAppsScript {
getAllBlobs(): Base.Blob[];
}
export interface GmailDraft {
/**
* Deletes this draft message.
*/
deleteDraft(): void;
/**
* Gets the ID of this draft message.
*/
getId(): string;
/**
* Returns a GmailMessage representing this draft.
*/
getMessage(): GmailMessage;
/**
* Returns the ID of the `GmailMessage` representing this draft.
*/
getMessageId(): string;
/**
* Sends this draft email message.
*/
send(): GmailMessage;
/**
* Replaces the contents of this draft message.
*/
update(recipient: string, subject: string, body: string): GmailDraft;
/**
* Replaces the contents of this draft message using optional arguments.
*/
update(recipient: string, subject: string, body: string, options: GmailDraftOptions): GmailDraft;
}
export type GmailDraftOptions = {
/**
* An array of files to send with the email.
*/
attachments?: Base.BlobSource[];
/**
* A comma-separated list of email addresses to BCC.
*/
bcc?: string;
/**
* A comma-separated list of email addresses to CC.
*/
cc?: string;
/**
* The address that the email should be sent from, which must be one of the values returned by `GmailApp.getAliases()`.
*/
from?: string;
/**
* If set, devices capable of rendering HTML will use it instead of the required body argument; you can add an optional `inlineImages` field in HTML body if you have inlined images for your email.
*/
htmlBody?: string;
/**
* A JavaScript object containing a mapping from image key (`String`) to image data (`BlobSource`) ; this assumes that the `htmlBody` parameter is used and contains references to these images in the format `<img src="cid:imageKey" />`.
*/
inlineImages?: { [imageKey: string]: Base.BlobSource };
/**
* The name of the sender of the email (default: the user's name).
*/
name?: string;
/**
* An email address to use as the default reply-to address (default: the user's email address).
*/
replyTo?: string;
}
/**
* A user-created label in a user's Gmail account.
*/
@@ -131,6 +203,10 @@ declare namespace GoogleAppsScript {
* A message in a user's Gmail account.
*/
export interface GmailMessage {
createDraftReply(body: string): GmailDraft;
createDraftReply(body: string, options: GmailDraftOptions): GmailDraft;
createDraftReplyAll(body: string): GmailDraft;
createDraftReplyAll(body: string, options: GmailDraftOptions): GmailDraft;
forward(recipient: string): GmailMessage;
forward(recipient: string, options: Object): GmailMessage;
getAttachments(): GmailAttachment[];
@@ -169,6 +245,10 @@ declare namespace GoogleAppsScript {
*/
export interface GmailThread {
addLabel(label: GmailLabel): GmailThread;
createDraftReply(body: string): GmailDraft;
createDraftReply(body: string, options: GmailDraftOptions): GmailDraft;
createDraftReplyAll(body: string): GmailDraft;
createDraftReplyAll(body: string, options: GmailDraftOptions): GmailDraft;
getFirstMessageSubject(): string;
getId(): string;
getLabels(): GmailLabel[];
+1
View File
@@ -7,6 +7,7 @@
/// <reference path="google-apps-script.base.d.ts"/>
/// <reference path="google-apps-script.cache.d.ts"/>
/// <reference path="google-apps-script.calendar.d.ts"/>
/// <reference path="google-apps-script.card.d.ts"/>
/// <reference path="google-apps-script.charts.d.ts"/>
/// <reference path="google-apps-script.contacts.d.ts"/>
/// <reference path="google-apps-script.content.d.ts"/>
+3 -3
View File
@@ -1,6 +1,6 @@
// Type definitions for Google Maps JavaScript API 3.29
// Type definitions for Google Maps JavaScript API 3.30
// Project: https://developers.google.com/maps/
// Definitions by: Folia A/S <http://www.folia.dk>, Chris Wrench <https://github.com/cgwrench>, Kiarash Ghiaseddin <https://github.com/Silver-Connection/DefinitelyTyped>, Grant Hutchins <https://github.com/nertzy>, Denis Atyasov <https://github.com/xaolas>, Michael McMullin <https://github.com/mrmcnerd>, Martin Costello <https://github.com/martincostello>
// Definitions by: Folia A/S <http://www.folia.dk>, Chris Wrench <https://github.com/cgwrench>, Kiarash Ghiaseddin <https://github.com/Silver-Connection/DefinitelyTyped>, Grant Hutchins <https://github.com/nertzy>, Denis Atyasov <https://github.com/xaolas>, Michael McMullin <https://github.com/mrmcnerd>, Martin Costello <https://github.com/martincostello>, Sven Kreiss <https://github.com/svenkreiss>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/*
@@ -2697,7 +2697,7 @@ declare namespace google.maps {
* Accepted values are 'marker', 'polygon', 'polyline', 'rectangle', 'circle', or null. A drawing mode
* of null means that the user can interact with the map as normal, and clicks do not draw anything.
*/
drawingMode?: OverlayType;
drawingMode?: OverlayType | null;
/**
* The Map to which the DrawingManager is attached, which is the Map on which the overlays created
* will be placed.
+11 -5
View File
@@ -1,13 +1,19 @@
// Type definitions for gzip-size 3.0
// Type definitions for gzip-size 4.0
// Project: https://github.com/sindresorhus/gzip-size
// Definitions by: York Yao <https://github.com/plantain-00>
// Jimi van der Woning <https://github.com/jimivdw>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
declare function gzipSize(input: string | Buffer, callback: (error: Error, size: number) => void): string;
export = gzipSize;
import * as stream from 'stream';
import * as zlib from 'zlib';
declare function gzipSize(input: string | Buffer, options?: zlib.ZlibOptions): Promise<number>;
declare namespace gzipSize {
function sync(input: string | Buffer): number;
function stream(): NodeJS.ReadWriteStream;
function sync(input: string | Buffer, options?: zlib.ZlibOptions): number;
function stream(options?: zlib.ZlibOptions): stream.PassThrough;
}
export = gzipSize;
+7
View File
@@ -0,0 +1,7 @@
import gzipSize = require('gzip-size');
const string = 'Lorem ipsum dolor sit amet.';
console.log(string.length);
console.log(gzipSize.sync(string));
+13
View File
@@ -0,0 +1,13 @@
// Type definitions for gzip-size 3.0
// Project: https://github.com/sindresorhus/gzip-size
// Definitions by: York Yao <https://github.com/plantain-00>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
declare function gzipSize(input: string | Buffer, callback: (error: Error, size: number) => void): string;
export = gzipSize;
declare namespace gzipSize {
function sync(input: string | Buffer): number;
function stream(): NodeJS.ReadWriteStream;
}
+28
View File
@@ -0,0 +1,28 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../../",
"typeRoots": [
"../../"
],
"types": [],
"paths": {
"gzip-size": [
"gzip-size/v3"
]
},
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"gzip-size-tests.ts"
]
}
+3
View File
@@ -0,0 +1,3 @@
{
"extends": "dtslint/dt.json"
}
+3 -1
View File
@@ -18,7 +18,7 @@ export interface History {
go(n: number): void;
goBack(): void;
goForward(): void;
block(prompt?: boolean): UnregisterCallback;
block(prompt?: boolean | string | TransitionPromptHook): UnregisterCallback;
listen(listener: LocationListener): UnregisterCallback;
createHref(location: LocationDescriptorObject): Href;
}
@@ -48,6 +48,7 @@ export namespace History {
export type Pathname = string;
export type Search = string;
export type TransitionHook = (location: Location, callback: (result: any) => void) => any;
export type TransitionPromptHook = (location: Location, action: Action) => string | false | void;
export type Hash = string;
export type Href = string;
}
@@ -60,6 +61,7 @@ export type Path = History.Path;
export type Pathname = History.Pathname;
export type Search = History.Search;
export type TransitionHook = History.TransitionHook;
export type TransitionPromptHook = History.TransitionPromptHook;
export type Hash = History.Hash;
export type Href = History.Href;
+7
View File
@@ -0,0 +1,7 @@
import * as Holder from "holderjs";
const myImage = document.getElementById('myImage');
Holder.run({
images: myImage
});
+10
View File
@@ -0,0 +1,10 @@
// Type definitions for holderjs 2.9
// Project: http://holderjs.com
// Definitions by: Soner Köksal <https://github.com/renjfk>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface Options {
images: HTMLElement | null;
}
export function run(options: Options): void;
+24
View File
@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6",
"dom"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"holderjs-tests.ts"
]
}
+1
View File
@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }
+695 -591
View File
File diff suppressed because it is too large Load Diff
+52 -16
View File
@@ -1,15 +1,13 @@
import * as Redis from "ioredis";
var redis = new Redis();
const redis = new Redis();
redis.set('foo', 'bar');
redis.get('foo', function(err, result) {
redis.get('foo', (err, result) => {
console.log(result);
});
// Or using a promise if the last argument isn't a function
redis.get('foo').then(function(result: any) {
redis.get('foo').then((result: any) => {
console.log(result);
});
@@ -18,24 +16,24 @@ redis.sadd('set', 1, 3, 5, 7);
redis.sadd('set', [1, 3, 5, 7]);
// All arguments are passed directly to the redis server:
redis.set('key', 100, 'EX', 10);
redis.set('key', '100', 'EX', 10);
new Redis() // Connect to 127.0.0.1:6379
new Redis(6380) // 127.0.0.1:6380
new Redis(6379, '192.168.1.1') // 192.168.1.1:6379
new Redis('/tmp/redis.sock')
new Redis(); // Connect to 127.0.0.1:6379
new Redis(6380); // 127.0.0.1:6380
new Redis(6379, '192.168.1.1'); // 192.168.1.1:6379
new Redis('/tmp/redis.sock');
new Redis({
port: 6379, // Redis port
host: '127.0.0.1', // Redis host
family: 4, // 4 (IPv4) or 6 (IPv6)
password: 'auth',
db: 0,
retryStrategy: function() { return false; },
retryStrategy() { return false; },
showFriendlyErrorStack: true
})
});
var pub = new Redis();
redis.subscribe('news', 'music', function(err: any, count: any) {
const pub = new Redis();
redis.subscribe('news', 'music', (err: any, count: any) => {
// Now we are subscribed to both the 'news' and 'music' channels.
// `count` represents the number of channels we are currently subscribed to.
@@ -43,7 +41,7 @@ redis.subscribe('news', 'music', function(err: any, count: any) {
pub.publish('music', 'Hello again!');
});
redis.on('message', function(channel: any, message: any) {
redis.on('message', (channel: any, message: any) => {
// Receive message Hello world! from channel news
// Receive message Hello again! from channel music
console.log('Receive message %s from channel %s', message, channel);
@@ -51,6 +49,44 @@ redis.on('message', function(channel: any, message: any) {
// There's also an event called 'messageBuffer', which is the same as 'message' except
// it returns buffers instead of strings.
redis.on('messageBuffer', function(channel: any, message: any) {
redis.on('messageBuffer', (channel: any, message: any) => {
// Both `channel` and `message` are buffers.
});
const pipeline = redis.pipeline();
pipeline.set('foo', 'bar');
pipeline.del('cc');
pipeline.exec((err, results) => {
// `err` is always null, and `results` is an array of responses
// corresponding to the sequence of queued commands.
// Each response follows the format `[err, result]`.
});
// You can even chain the commands:
redis.pipeline().set('foo', 'bar').del('cc').exec((err, results) => {
});
// `exec` also returns a Promise:
const promise = redis.pipeline().set('foo', 'bar').get('foo').exec();
promise.then((result) => {
// result === [[null, 'OK'], [null, 'bar']]
});
redis.pipeline().set('foo', 'bar').get('foo', (err, result) => {
// result === 'bar'
}).exec((err, result) => {
// result[1][1] === 'bar'
});
redis.pipeline([
['set', 'foo', 'bar'],
['get', 'foo']
]).exec(() => { /* ... */ });
Redis.Command.setArgumentTransformer('set', args => {
return args;
});
Redis.Command.setReplyTransformer('get', (result: any) => {
return result;
});
+1 -79
View File
@@ -1,79 +1 @@
{
"extends": "dtslint/dt.json",
"rules": {
"adjacent-overload-signatures": false,
"array-type": false,
"arrow-return-shorthand": false,
"ban-types": false,
"callable-types": false,
"comment-format": false,
"dt-header": false,
"eofline": false,
"export-just-namespace": false,
"import-spacing": false,
"interface-name": false,
"interface-over-type-literal": false,
"jsdoc-format": false,
"max-line-length": false,
"member-access": false,
"new-parens": false,
"no-any-union": false,
"no-boolean-literal-compare": false,
"no-conditional-assignment": false,
"no-consecutive-blank-lines": false,
"no-construct": false,
"no-declare-current-package": false,
"no-duplicate-imports": false,
"no-duplicate-variable": false,
"no-empty-interface": false,
"no-for-in-array": false,
"no-inferrable-types": false,
"no-internal-module": false,
"no-irregular-whitespace": false,
"no-mergeable-namespace": false,
"no-misused-new": false,
"no-namespace": false,
"no-object-literal-type-assertion": false,
"no-padding": false,
"no-redundant-jsdoc": false,
"no-redundant-jsdoc-2": false,
"no-redundant-undefined": false,
"no-reference-import": false,
"no-relative-import-in-test": false,
"no-self-import": false,
"no-single-declare-module": false,
"no-string-throw": false,
"no-unnecessary-callback-wrapper": false,
"no-unnecessary-class": false,
"no-unnecessary-generics": false,
"no-unnecessary-qualifier": false,
"no-unnecessary-type-assertion": false,
"no-useless-files": false,
"no-var-keyword": false,
"no-var-requires": false,
"no-void-expression": false,
"no-trailing-whitespace": false,
"object-literal-key-quotes": false,
"object-literal-shorthand": false,
"one-line": false,
"one-variable-per-declaration": false,
"only-arrow-functions": false,
"prefer-conditional-expression": false,
"prefer-const": false,
"prefer-declare-function": false,
"prefer-for-of": false,
"prefer-method-signature": false,
"prefer-template": false,
"radix": false,
"semicolon": false,
"space-before-function-paren": false,
"space-within-parens": false,
"strict-export-declare-modifiers": false,
"trim-file": false,
"triple-equals": false,
"typedef-whitespace": false,
"unified-signatures": false,
"void-return": false,
"whitespace": false
}
}
{ "extends": "dtslint/dt.json" }
+1
View File
@@ -6,5 +6,6 @@
declare function Given(func: (done?: () => void) => void): void;
declare function When(func: (done?: () => void) => void): void;
declare function Then(func: (done?: () => void) => void): void;
declare function Then(label: string, func: (done?: () => void) => void): void;
declare function And(func: (done?: () => void) => void): void;
declare function Invariant(func: (done?: () => void) => void): void;
+3 -1
View File
@@ -4,6 +4,8 @@ When(() => { });
Then(() => { });
Then('expected condition 1', () => { });
And(() => { });
Invariant(() => { });
@@ -20,7 +22,7 @@ When((done) => {
}
});
Then((done) => {
Then('expected condition 2', (done) => {
if (done) {
done();
}
+18 -7
View File
@@ -1,4 +1,4 @@
// Type definitions for Jasmine 2.6.0
// Type definitions for Jasmine 2.8.0
// Project: http://jasmine.github.io/
// Definitions by: Boris Yankov <https://github.com/borisyankov>, Theodore Brown <https://github.com/theodorejb>, David Pärsson <https://github.com/davidparsson>, Gabe Moothart <https://github.com/gmoothart>, Lukas Zech <https://github.com/lukas-zech-software>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -90,6 +90,11 @@ declare function expect<T>(actual: ArrayLike<T>): jasmine.ArrayLikeMatchers<T>;
*/
declare function expect<T>(actual: T): jasmine.Matchers<T>;
/**
* Create an expectation for a spec.
*/
declare function expect(): jasmine.NothingMatcher;
/**
* Explicitly mark a spec as failed.
* @param e
@@ -134,9 +139,10 @@ declare namespace jasmine {
function anything(): Any;
function arrayContaining(sample: any[]): ArrayContaining;
function arrayContaining<T>(sample: ArrayLike<T>): ArrayContaining<T>;
function arrayWithExactContents<T>(sample: ArrayLike<T>): ArrayContaining<T>;
function objectContaining<T>(sample: Partial<T>): ObjectContaining<T>;
function createSpy(name: string, originalFn?: Function): Spy;
function createSpy(name?: string, originalFn?: Function): Spy;
function createSpyObj(baseName: string, methodNames: any[] | {[methodName: string]: any}): any;
function createSpyObj<T>(baseName: string, methodNames: any[] | {[methodName: string]: any}): SpyObj<T>;
@@ -172,8 +178,8 @@ declare namespace jasmine {
[n: number]: T;
}
interface ArrayContaining {
new (sample: any[]): any;
interface ArrayContaining<T> {
new (sample: ArrayLike<T>): ArrayLike<T>;
asymmetricMatch(other: any): boolean;
jasmineToString(): string;
@@ -440,18 +446,23 @@ declare namespace jasmine {
toThrow(expected?: any): boolean;
toThrowError(message?: string | RegExp): boolean;
toThrowError(expected?: new (...args: any[]) => Error, message?: string | RegExp): boolean;
not: Matchers<T>;
Any: Any;
}
interface ArrayLikeMatchers<T> extends Matchers<ArrayLike<T>> {
toBe(expected: Expected<ArrayLike<T>>, expectationFailOutput?: any): boolean;
toEqual(expected: Expected<ArrayLike<T>>, expectationFailOutput?: any): boolean;
toBe(expected: Expected<ArrayLike<T>> | ArrayContaining<T>, expectationFailOutput?: any): boolean;
toEqual(expected: Expected<ArrayLike<T>> | ArrayContaining<T>, expectationFailOutput?: any): boolean;
toContain(expected: Expected<T>, expectationFailOutput?: any): boolean;
not: ArrayLikeMatchers<T>;
}
interface NothingMatcher {
nothing(): void;
}
interface Reporter {
reportRunnerStarting(runner: Runner): void;
reportRunnerResults(runner: Runner): void;

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