Merge branch 'master' into master

This commit is contained in:
deskoh
2019-01-15 22:26:56 +08:00
committed by GitHub
112 changed files with 8004 additions and 172 deletions

View File

@@ -1,6 +1,4 @@
# DefinitelyTyped [![Build Status](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped.svg?branch=master)](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped)
[![Join the chat at https://gitter.im/borisyankov/DefinitelyTyped](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/borisyankov/DefinitelyTyped?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
# DefinitelyTyped
> The repository for *high quality* TypeScript type definitions.
@@ -8,6 +6,19 @@ Also see the [definitelytyped.org](http://definitelytyped.org) website, although
*You can also read this README in [Spanish](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.es.md), [Korean](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.ko.md), and [Russian](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.ru.md)!*
## Current status
This section tracks the health of the repository and publishing process.
It may be helpful for contributors experiencing any issues with their PRs and packages.
* All packages are type-checking/linting cleanly: [![Build Status](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped.svg?branch=master)](https://travis-ci.org/DefinitelyTyped/DefinitelyTyped)
* All packages are being published to npm in under 10,000 seconds: [![Publish Status](https://typescript.visualstudio.com/TypeScript/_apis/build/status/sandersn.types-publisher-watchdog)](https://typescript.visualstudio.com/TypeScript/_build/latest?definitionId=13)
* [typescript-bot](https://github.com/typescript-bot) has been active on DefinitelyTyped [![Activity Status](https://typescript.visualstudio.com/TypeScript/_apis/build/status/sandersn.typescript-bot-watchdog)](https://typescript.visualstudio.com/TypeScript/_build/latest?definitionId=14)
If anything here seems wrong, or any of the above are failing, please raise an issue in [the DefinitelyTyped Gitter channel](https://gitter.im/DefinitelyTyped/DefinitelyTyped).
[![Join the chat at https://gitter.im/DefinitelyTyped/DefinitelyTyped](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/DefinitelyTyped/DefinitelyTyped?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
## What are declaration files?
See the [TypeScript handbook](http://www.typescriptlang.org/docs/handbook/declaration-files/introduction.html).
@@ -342,6 +353,3 @@ This project is licensed under the MIT license.
Copyrights on the definition files are respective of each contributor listed at the beginning of each definition file.
[![Analytics](https://ga-beacon.appspot.com/UA-47495295-4/borisyankov/DefinitelyTyped)](https://github.com/igrigorik/ga-beacon)
[![Build Status](https://typescript.visualstudio.com/TypeScript/_apis/build/status/sandersn.types-publisher-watchdog)](https://typescript.visualstudio.com/TypeScript/_build/latest?definitionId=13) Are packages being published to npm in less than 10,000 seconds on average?
[![Build Status](https://typescript.visualstudio.com/TypeScript/_apis/build/status/sandersn.typescript-bot-watchdog)](https://typescript.visualstudio.com/TypeScript/_build/latest?definitionId=14) Has typescript-bot been active on DefinitelyTyped in the last two hours?

View File

@@ -8,7 +8,7 @@
Также посетите веб-сайт [definitelytyped.org](http://definitelytyped.org), хотя информация в этом README более свежая.
*Вы также можете прочитать этот README на [английском](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md), [испанском](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.es.md) and [корейском](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.ko.md).*
*Вы также можете прочитать этот README на [английском](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.md), [испанском](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.es.md) и [корейском](https://github.com/DefinitelyTyped/DefinitelyTyped/blob/master/README.ko.md).*
## Что такое файлы декларации (файлы описания/объявления типов)?
@@ -101,9 +101,9 @@ DefinitelyTyped работает только благодаря вкладу т
// John <https://github.com/john>
```
* Если есть `tslint.json`, запустите `npm run lint package-name`. В противном случае запустите `tsc` in в директории пакета.
* Если есть `tslint.json`, запустите `npm run lint package-name`. В противном случае запустите `tsc` в директории пакета.
Когда вы создаете PR для редактирования существующего пакета, `dt-bot` должен @-уведомить previous authors.
Когда вы создаете PR для редактирования существующего пакета, `dt-bot` должен @-уведомить
предыдущих авторов. Если этого не произойдет, вы можете сделать это самостоятельно в комментарии, связанном с PR.
@@ -124,7 +124,7 @@ DefinitelyTyped работает только благодаря вкладу т
| tsconfig.json | Позволяет вам запускать `tsc` внутри пакета. |
| tslint.json | Включает linting. |
Создайте их, запустив `npx dts-gen --dt --name my-package-name --template module` если у вас ≥ 5.2.0, `npm install -g dts-gen` и `dts-gen --dt --name my-package-name --template module` в противном случае.
Создайте их, запустив `npx dts-gen --dt --name my-package-name --template module` если у вас npm ≥ 5.2.0, `npm install -g dts-gen` и `dts-gen --dt --name my-package-name --template module` в противном случае.
Посмотреть все варианты на [dts-gen](https://github.com/Microsoft/dts-gen).
Вы можете отредактировать `tsconfig.json` чтобы добавить новые файлы, добавить `"target": "es6"` (необходимо для асинхронных функций), добавить в `"lib"`, или добавить опцию компилятора `"jsx"`.
@@ -283,7 +283,7 @@ f("one");
"typeRoots": ["../../"],
"paths": {
"history": [ "history/v2" ]
},
}
},
"files": [
"index.d.ts",

View File

@@ -0,0 +1,14 @@
import * as lib from 'country-data';
lib.callingCodes.all; // $ExpectType ReadonlyArray<string>
lib.callingCountries.all; // $ExpectType ReadonlyArray<Country>
lib.continents.africa; // $ExpectType Continent
lib.continents.africa.countries; // $ExpectType ReadonlyArray<Country>
lib.countries.all; // $ExpectType ReadonlyArray<Country>
lib.currencies.all; // $ExpectType ReadonlyArray<Currency>
lib.languages.all; // $ExpectType ReadonlyArray<Language>
lib.regions.antarctica; // $ExpectType Region
lib.regions.antarctica.countries; // $ExpectType ReadonlyArray<string>
lib.lookup.countries(""); // $ExpectType ReadonlyArray<Country>
lib.lookup.currencies(""); // $ExpectType ReadonlyArray<Currency>
lib.lookup.languages(""); // $ExpectType ReadonlyArray<Language>

103
types/country-data/index.d.ts vendored Normal file
View File

@@ -0,0 +1,103 @@
// Type definitions for country-data 0.0
// Project: https://github.com/OpenBookPrices/country-data
// Definitions by: Logan Dam <https://github.com/biltongza>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export interface Country {
readonly alpha2: string;
readonly alpha3: string;
readonly countryCallingCodes: ReadonlyArray<string>;
readonly currencies: ReadonlyArray<string>;
readonly emoji: string;
readonly ioc: string;
readonly languages: ReadonlyArray<string>;
readonly name: string;
readonly status: string;
}
export interface Currency {
readonly code: string;
readonly decimals: number;
readonly name: string;
readonly number: number;
}
export interface Language {
readonly alpha2: string;
readonly alpha3: string;
readonly bibliographic: string;
readonly name: string;
}
export interface Continent {
readonly name: string;
readonly regions: ReadonlyArray<string>;
readonly countries: ReadonlyArray<Country>;
}
export interface Region {
readonly name: string;
readonly countries: ReadonlyArray<string>;
}
export const countries: {
readonly all: ReadonlyArray<Country>;
};
export const continents: {
readonly africa: Continent;
readonly antarctica: Continent;
readonly asia: Continent;
readonly europe: Continent;
readonly northAmerica: Continent;
readonly oceania: Continent;
readonly southAmerica: Continent;
};
export const callingCodes: {
readonly all: ReadonlyArray<string>;
};
export const callingCountries: {
readonly all: ReadonlyArray<Country>;
};
export const currencies: {
readonly all: ReadonlyArray<Currency>;
};
export const languages: {
readonly all: ReadonlyArray<Language>;
};
export const regions: {
readonly centralAsia: Region;
readonly southernAsia: Region;
readonly southeastAsia: Region;
readonly eastAsia: Region;
readonly westernAsia: Region;
readonly centralAfrica: Region;
readonly northAfrica: Region;
readonly southernAfrica: Region;
readonly eastAfrica: Region;
readonly westAfrica: Region;
readonly centralAmerica: Region;
readonly northernAmerica: Region;
readonly caribbean: Region;
readonly southAmerica: Region;
readonly antarctica: Region;
readonly northernEurope: Region;
readonly southernEurope: Region;
readonly easternEurope: Region;
readonly westernEurope: Region;
readonly australia: Region;
readonly melanesia: Region;
readonly micronesia: Region;
readonly polynesia: Region;
};
export const lookup: {
readonly countries: (query: any) => ReadonlyArray<Country>;
readonly currencies: (query: any) => ReadonlyArray<Currency>;
readonly languages: (query: any) => ReadonlyArray<Language>;
};

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",
"country-data-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -5,6 +5,11 @@ function add10(n: number) {
CustomFunctions.associate('ADD10', add10);
CustomFunctions.associate({
ADD10: add10,
RANDOM: (n: number) => n * Math.random()
});
async function getStockValues(ticker: string): Promise<number> {
const response = await fetch(`myService.com/prices/${ticker}`);
return (await response.json())["price"];

View File

@@ -16,9 +16,14 @@ Copyright (c) Microsoft Corporation
declare namespace CustomFunctions {
/**
* @beta
* Ties together the function's JavaScript name with the JSON id property
* Associates the JavaScript function to the name given by the "id" property in the metadata JSON file.
*/
function associate(id: string, functionObject: Function): void;
/**
* @beta
* Associates the JavaScript functions to the names given by the "id" properties in the metadata JSON file.
*/
function associate(mappings: { [key: string]: Function }): void;
/**
* A handler passed automatically as the last parameter
@@ -28,7 +33,6 @@ declare namespace CustomFunctions {
* to handle what happens when the function stops streaming.
* @beta
*/
interface StreamingHandler<T> extends CancelableHandler {
/**
* Sets the returned result for a streaming custom function.
@@ -36,6 +40,7 @@ declare namespace CustomFunctions {
*/
setResult: (value: T | Error) => void;
}
/**
* @beta
* CancelableHandler interface

View File

@@ -371,6 +371,7 @@ const gnomonicRaw: d3Geo.GeoRawProjection = d3Geo.geoGnomonicRaw();
const mercatorRaw: d3Geo.GeoRawProjection = d3Geo.geoMercatorRaw();
const orthographicRaw: d3Geo.GeoRawProjection = d3Geo.geoOrthographicRaw();
const stereographicRaw: d3Geo.GeoRawProjection = d3Geo.geoStereographicRaw();
const equalEarthRaw: d3Geo.GeoRawProjection = d3Geo.geoEqualEarthRaw();
const transverseMercatorRaw: d3Geo.GeoRawProjection = d3Geo.geoTransverseMercatorRaw();
const naturalEarth1Raw: d3Geo.GeoRawProjection = d3Geo.geoNaturalEarth1Raw();
@@ -398,6 +399,7 @@ const gnomonic: d3Geo.GeoProjection = d3Geo.geoGnomonic();
const mercator: d3Geo.GeoProjection = d3Geo.geoMercator();
const orthographic: d3Geo.GeoProjection = d3Geo.geoOrthographic();
const stereographic: d3Geo.GeoProjection = d3Geo.geoStereographic();
const equalEarth: d3Geo.GeoProjection = d3Geo.geoEqualEarth();
const transverseMercator: d3Geo.GeoProjection = d3Geo.geoTransverseMercator();
const naturalEarth1: d3Geo.GeoProjection = d3Geo.geoNaturalEarth1();

View File

@@ -1,10 +1,10 @@
// Type definitions for D3JS d3-geo module 1.10
// Type definitions for D3JS d3-geo module 1.11
// Project: https://github.com/d3/d3-geo/
// Definitions by: Hugues Stefanski <https://github.com/ledragon>, Tom Wanzek <https://github.com/tomwanzek>, Alex Ford <https://github.com/gustavderdrache>, Boris Yankov <https://github.com/borisyankov>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// Last module patch version validated against: 1.10.0
// Last module patch version validated against: 1.11.3
import * as GeoJSON from 'geojson';
@@ -1345,11 +1345,22 @@ export function geoOrthographicRaw(): GeoRawProjection;
* The stereographic projection.
*/
export function geoStereographic(): GeoProjection;
/**
* The raw stereographic projection.
*/
export function geoStereographicRaw(): GeoRawProjection;
/**
* The Equal Eartch projection, by Bojan Šavrič et al., 2018.
*/
export function geoEqualEarth(): GeoProjection;
/**
* The raw Equal Earth projection, by Bojan Šavrič et al., 2018.
*/
export function geoEqualEarthRaw(): GeoRawProjection;
// Composite Projections ---------------------------------------------------
/**

4
types/d3/index.d.ts vendored
View File

@@ -1,4 +1,4 @@
// Type definitions for D3JS d3 standard bundle 5.5
// Type definitions for D3JS d3 standard bundle 5.7
// Project: https://github.com/d3/d3
// Definitions by: Tom Wanzek <https://github.com/tomwanzek>
// Alex Ford <https://github.com/gustavderdrache>
@@ -7,7 +7,7 @@
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
// Last module patch version validated against: 5.5.0
// Last module patch version validated against: 5.7.0
// NOTE TO MAINTAINERS: Review D3 v4.x module dependencies (see v4 sub-folder) and update its path-mappings in tsconfig (v4 folder),
// if new MAJOR version of D3 v4 modules are released!!!

View File

@@ -0,0 +1,4 @@
import dogeSeed = require('doge-seed');
dogeSeed(); // $ExpectType string
dogeSeed(128); // $ExpectType string

18
types/doge-seed/index.d.ts vendored Normal file
View File

@@ -0,0 +1,18 @@
// Type definitions for doge-seed 1.0
// Project: https://github.com/lukechilds/doge-seed#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = dogeSeed;
/**
* Generates a cryptographically secure mnemonic seed phrase with added dankness.
* The first four words will be a randomly generated Doge-like sentence.
*
* The seed phrases are fully valid checksummed BIP39 seeds. They can be used with any cryptocurrency
* and can be imported into any BIP39 compliant wallet.
*
* @param bits The number of bits to derive a BIP39 mnemonic from. Default: `128`.
* @returns A BIP39 mnemonic seed phrase.
*/
declare function dogeSeed(bits?: 128 | 160 | 192 | 224 | 256): string;

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",
"doge-seed-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -0,0 +1,6 @@
import firstRun = require('first-run');
firstRun(); // $ExpectType boolean
firstRun({ name: 'foo' }); // $ExpectType boolean
firstRun.clear();

26
types/first-run/index.d.ts vendored Normal file
View File

@@ -0,0 +1,26 @@
// Type definitions for first-run 1.2
// Project: https://github.com/sindresorhus/first-run
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = firstRun;
/**
* Check if it's the first time the process is run.
*/
declare function firstRun(options?: firstRun.Options): boolean;
declare namespace firstRun {
/**
* Clear the state.
*/
function clear(): void;
interface Options {
/**
* The name used to identify it.
* @default name field in your package.json
*/
name: string;
}
}

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",
"first-run-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -0,0 +1,4 @@
import hexRgb = require('hex-rgb');
hexRgb('#cd2222cc'); // $ExpectType RgbaObj
hexRgb('#cd2222cc', { format: 'array' }); // $ExpectType [number, number, number, number]

24
types/hex-rgb/index.d.ts vendored Normal file
View File

@@ -0,0 +1,24 @@
// Type definitions for hex-rgb 3.0
// Project: https://github.com/sindresorhus/hex-rgb#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = hexRgb;
declare function hexRgb(hex: string): hexRgb.RgbaObj;
declare function hexRgb(hex: string, options: hexRgb.Options): hexRgb.RgbaArr;
declare namespace hexRgb {
interface Options {
format: 'array';
}
interface RgbaObj {
red: number;
green: number;
blue: number;
alpha: number;
}
type RgbaArr = [number, number, number, number];
}

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",
"hex-rgb-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -0,0 +1,9 @@
import htmlTags = require('html-tags');
import voidHtmlTags = require('html-tags/void');
import htmlTagsJson = require('html-tags/html-tags.json');
import voidHtmlTagsJson = require('html-tags/html-tags-void.json');
htmlTags; // $ExpectType string[]
voidHtmlTags; // $ExpectType string[]
htmlTagsJson; // $ExpectType string[]
voidHtmlTagsJson; // $ExpectType string[]

View File

@@ -0,0 +1,3 @@
export = voidHtmlTags;
declare const voidHtmlTags: string[];

3
types/html-tags/html-tags.json.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
export = htmlTags;
declare const htmlTags: string[];

8
types/html-tags/index.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
// Type definitions for html-tags 2.0
// Project: https://github.com/sindresorhus/html-tags#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = htmlTags;
declare const htmlTags: string[];

View File

@@ -0,0 +1,26 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"void.d.ts",
"html-tags.json.d.ts",
"html-tags-void.json.d.ts",
"html-tags-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

3
types/html-tags/void.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
export = voidHtmlTags;
declare const voidHtmlTags: string[];

View File

@@ -1,13 +1,14 @@
import { Observable } from 'rxjs';
import httpRx = require('http-rx');
import request = require('request');
const httpGet: Observable<any> = httpRx.get('');
const httpGet: Observable<{response: request.Response}> = httpRx.get('');
const httpHead: Observable<number> = httpRx.head('');
const httpHead: Observable<{body: any}> = httpRx.head('');
const httpPatch: Observable<string> = httpRx.patch('');
const httpPatch: Observable<{response: request.Response, body: any}> = httpRx.patch('');
const httpPost: Observable<void> = httpRx.post('');
const httpPost: Observable<{response: request.Response, body: any}> = httpRx.post('', {json: true});
const httpPut: Observable<{}> = httpRx.put('');

View File

@@ -1,4 +1,4 @@
// Type definitions for http-rx 1.1
// Type definitions for http-rx 2.0
// Project: https://github.com/JasonRammoray/HttpRx
// Definitions by: L2jLiga <https://github.com/L2jLiga>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -7,18 +7,23 @@
import { Observable } from 'rxjs';
import request = require('request');
interface ResponseWrapper {
response: request.Response;
body: any;
}
interface HttpRx {
get(url: string, options?: request.CoreOptions): Observable<any>;
get(url: string, options?: request.CoreOptions): Observable<ResponseWrapper>;
head(url: string, options?: request.CoreOptions): Observable<any>;
head(url: string, options?: request.CoreOptions): Observable<ResponseWrapper>;
patch(url: string, options?: request.CoreOptions): Observable<any>;
patch(url: string, options?: request.CoreOptions): Observable<ResponseWrapper>;
post(url: string, options?: request.CoreOptions): Observable<any>;
post(url: string, options?: request.CoreOptions): Observable<ResponseWrapper>;
put(url: string, options?: request.CoreOptions): Observable<any>;
put(url: string, options?: request.CoreOptions): Observable<ResponseWrapper>;
'delete'(url: string, options?: request.CoreOptions): Observable<any>;
delete(url: string, options?: request.CoreOptions): Observable<ResponseWrapper>;
}
declare const httpRx: HttpRx;

8
types/js-types/index.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
// Type definitions for js-types 2.0
// Project: https://github.com/sindresorhus/js-types#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = jsTypes;
declare const jsTypes: string[];

View File

@@ -0,0 +1,5 @@
import jsTypes = require('js-types');
import jsTypesJson = require('js-types/js-types.json');
jsTypes; // $ExpectType string[]
jsTypesJson; // $ExpectType string[]

3
types/js-types/js-types.json.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
export = jsTypes;
declare const jsTypes: string[];

View File

@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"js-types.json.d.ts",
"js-types-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -1,4 +1,4 @@
// Type definitions for KeyboardJS v2.4.1
// Type definitions for KeyboardJS v2.4.2
// Project: https://github.com/RobertWHurst/KeyboardJS
// Definitions by: Vincent Bortone <https://github.com/vbortone>,
// David Asmuth <https://github.com/piranha771>,
@@ -92,14 +92,16 @@ declare namespace keyboardjs {
/**
* Triggers a key press. Stays in pressed state until released.
* @param keyCombo String of keys to be pressed to execute 'pressed' callbacks.
* @param keyCombo String of keys or keyCode to be pressed to execute 'pressed' callbacks.
* @param event The KeyEvent, can be null.
*/
export function pressKey(keyCombo: string): void
export function pressKey(keyCombo: string | number, event?: KeyEvent): void;
/**
* Triggers a key release.
* @param keyCombo String of keys to be released to execute 'released' callbacks.
* @param keyCombo String of keys or keyCode to be released to execute 'released' callbacks.
* @param event The KeyEvent, can be null.
*/
export function releaseKey(keyCombo: string): void;
export function releaseKey(keyCombo: string | number, event?: KeyEvent): void;
/**
* Releases all keys.
*/

14
types/latest-version/index.d.ts vendored Normal file
View File

@@ -0,0 +1,14 @@
// Type definitions for latest-version 4.0
// Project: https://github.com/sindresorhus/latest-version#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = latestVersion;
declare function latestVersion(name: string, options?: latestVersion.Options): Promise<string>;
declare namespace latestVersion {
interface Options {
version?: string;
}
}

View File

@@ -0,0 +1,4 @@
import latestVersion = require('latest-version');
latestVersion('ava'); // $ExpectType Promise<string>
latestVersion('npm', { version: 'latest-5' }); // $ExpectType Promise<string>

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",
"latest-version-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -7,10 +7,12 @@
export * from 'libsodium-wrappers';
import {
Uint8ArrayOutputFormat,
StringOutputFormat,
KeyPair,
onetimeauth_state_address,
state_address,
StringKeyPair,
StringOutputFormat,
Uint8ArrayOutputFormat,
} from 'libsodium-wrappers';
export const crypto_auth_hmacsha256_BYTES: number;
@@ -77,6 +79,12 @@ export const crypto_stream_xchacha20_KEYBYTES: number;
export const crypto_stream_xchacha20_NONCEBYTES: number;
export const crypto_box_curve25519xchacha20poly1305_NONCEBYTES: number;
export const crypto_box_curve25519xchacha20poly1305_PUBLICKEYBYTES: number;
export const crypto_box_curve25519xchacha20poly1305_SECRETKEYBYTES: number;
export function crypto_auth_hmacsha256(
message: string | Uint8Array,
key: Uint8Array,
@@ -113,6 +121,18 @@ export function crypto_auth_hmacsha512_keygen(outputFormat?: StringOutputFormat
export function crypto_auth_hmacsha512_verify(tag: Uint8Array, message: string | Uint8Array, key: Uint8Array): boolean;
export function crypto_box_curve25519xchacha20poly1305_keypair(publicKey: Uint8Array, secretKey: Uint8Array, outputFormat?: Uint8ArrayOutputFormat | null): KeyPair;
export function crypto_box_curve25519xchacha20poly1305_keypair(publicKey: Uint8Array, secretKey: Uint8Array, outputFormat?: StringOutputFormat | null): StringKeyPair;
export function crypto_box_curve25519xchacha20poly1305_seal(message: Uint8Array, publicKey: Uint8Array, outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array;
export function crypto_box_curve25519xchacha20poly1305_seal(message: Uint8Array, publicKey: Uint8Array, outputFormat?: StringOutputFormat | null): string;
export function crypto_box_curve25519xchacha20poly1305_seal_open(ciphertext: Uint8Array, publicKey: Uint8Array, secretKey: Uint8Array, outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array;
export function crypto_box_curve25519xchacha20poly1305_seal_open(ciphertext: Uint8Array, publicKey: Uint8Array, secretKey: Uint8Array, outputFormat?: StringOutputFormat | null): string;
export function crypto_hash_sha256(
message: string | Uint8Array,
outputFormat?: Uint8ArrayOutputFormat | null,
@@ -240,6 +260,10 @@ export function crypto_sign_ed25519_sk_to_seed(
outputFormat?: StringOutputFormat | null,
): string;
export function crypto_stream_chacha20(outLength: number, key: Uint8Array, nonce: Uint8Array, outputFormat?: StringOutputFormat | null): string;
export function crypto_stream_chacha20(outLength: number, key: Uint8Array, nonce: Uint8Array, outputFormat?: Uint8ArrayOutputFormat | null): Uint8Array;
export function crypto_stream_chacha20_ietf_xor(
input_message: string | Uint8Array,
nonce: Uint8Array,

View File

@@ -886,30 +886,30 @@ export function crypto_secretstream_xchacha20poly1305_keygen(outputFormat?: Uint
export function crypto_secretstream_xchacha20poly1305_keygen(outputFormat?: StringOutputFormat | null): string;
export function crypto_secretstream_xchacha20poly1305_pull(
state_address?: secretstream_xchacha20poly1305_state_address,
cipher?: string | Uint8Array,
state_address: secretstream_xchacha20poly1305_state_address,
cipher: string | Uint8Array,
ad?: string | Uint8Array | null,
outputFormat?: Uint8ArrayOutputFormat | null,
): { message: Uint8Array; tag: Uint8Array };
): { message: Uint8Array; tag: number };
export function crypto_secretstream_xchacha20poly1305_pull(
state_address?: secretstream_xchacha20poly1305_state_address,
cipher?: string | Uint8Array,
state_address: secretstream_xchacha20poly1305_state_address,
cipher: string | Uint8Array,
ad?: string | Uint8Array | null,
outputFormat?: StringOutputFormat | null,
): { message: string; tag: Uint8Array };
): { message: string; tag: number };
export function crypto_secretstream_xchacha20poly1305_push(
state_address?: secretstream_xchacha20poly1305_state_address,
message_chunk?: string | Uint8Array,
state_address: secretstream_xchacha20poly1305_state_address,
message_chunk: string | Uint8Array,
ad?: string | Uint8Array | null,
tag?: number,
outputFormat?: Uint8ArrayOutputFormat | null,
): Uint8Array;
export function crypto_secretstream_xchacha20poly1305_push(
state_address?: secretstream_xchacha20poly1305_state_address,
message_chunk?: string | Uint8Array,
state_address: secretstream_xchacha20poly1305_state_address,
message_chunk: string | Uint8Array,
ad?: string | Uint8Array | null,
tag?: number,
outputFormat?: StringOutputFormat | null,

71
types/loopbench/index.d.ts vendored Normal file
View File

@@ -0,0 +1,71 @@
// Type definitions for loopbench 1.2
// Project: https://github.com/mcollina/loopbench#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
import { EventEmitter } from 'events';
export = loopbench;
/**
* Creates a new instance of loopbench.
*/
declare function loopbench(options?: loopbench.Options): loopbench.LoopBench;
declare namespace loopbench {
interface Options {
/**
* The interval at which the eventLoop should be sampled, defaults to `5`.
*/
sampleInterval?: number;
/**
* The maximum amount of delay that is tolerated before `overLimit` becomes true,
* and the `load` event is emitted, defaults to `42`.
*/
limit?: number;
}
/**
* Events:
* - `load`, emitted when `instance.delay > instance.limit`
* - `unload`, emitted when `overLimit` goes from `true` and `false`
*/
interface LoopBench extends EventEmitter {
/**
* The delay in milliseconds (and fractions) from the expected run. It might be negative (in older nodes).
*/
readonly delay: number;
/**
* The maximum amount of delay that is tolerated before `overLimit` becomes true,
* and the `load` event is emitted.
*/
readonly limit: number;
/**
* Is `true` if the `instance.delay > instance.limit`.
*/
readonly overLimit: boolean;
/**
* Stops the sampling.
*/
stop(): void;
addListener(event: 'load' | 'unload', listener: () => void): this;
on(event: 'load' | 'unload', listener: () => void): this;
once(event: 'load' | 'unload', listener: () => void): this;
removeListener(event: 'load' | 'unload', listener: () => void): this;
off(event: 'load' | 'unload', listener: () => void): this;
removeAllListeners(event?: 'load' | 'unload'): this;
listeners(event: 'load' | 'unload'): Array<() => void>;
rawListeners(event: 'load' | 'unload'): Array<() => void>;
emit(event: 'load' | 'unload'): boolean;
listenerCount(type: 'load' | 'unload'): number;
prependListener(event: 'load' | 'unload', listener: () => void): this;
prependOnceListener(event: 'load' | 'unload', listener: () => void): this;
eventNames(): Array<'load' | 'unload'>;
}
}

View File

@@ -0,0 +1,11 @@
import loopbench = require('loopbench');
const inst = loopbench();
inst; // $ExpectType LoopBench
loopbench({ sampleInterval: 1 }); // $ExpectType LoopBench
loopbench({ limit: 1 }); // $ExpectType LoopBench
inst.delay; // $ExpectType number
inst.limit; // $ExpectType number
inst.overLimit; // $ExpectType boolean
inst.stop();

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",
"loopbench-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

4383
types/mangopay2-nodejs-sdk/index.d.ts vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,721 @@
import Mangopay = require("mangopay2-nodejs-sdk");
// $ExpectError
const invalidConfig: Mangopay.Config = {};
/* General Types */
const validConfig: Mangopay.Config = {
clientId: "your_client_id",
clientApiKey: "your_client_api_key",
baseUrl: "https://api.mangopay.com"
};
const api = new Mangopay(validConfig); // IGNORE-TEST $ExpectType MangoPay
const payIn: Mangopay.models.PayIn = new api.models.PayIn({}); // IGNORE-TEST $ExpectType PayIn
const address: Mangopay.models.Address = new api.models.Address({}); // IGNORE-TEST $ExpectType Address
const addressData: Mangopay.address.AddressData = {
AddressLine1: "20 T Street",
AddressLine2: "",
City: "London",
Country: "UK",
PostalCode: "FR43 2WE",
Region: "London"
};
/* Users */
const legalUser = new api.models.UserLegal({
Name: "MangoPay",
Email: "info@mangopay.com",
LegalPersonType: "BUSINESS",
LegalRepresentativeFirstName: "Mango",
LegalRepresentativeLastName: "Pay",
LegalRepresentativeEmail: "mango@mangopay.com",
HeadquartersAddress: new api.models.Address({
AddressLine1: "4101 Reservoir Rd NW",
AddressLine2: "",
City: "Washington",
Region: "District of Columbia",
PostalCode: "20007",
Country: "US"
}),
LegalRepresentativeBirthday: 1300186358,
LegalRepresentativeNationality: "FR",
LegalRepresentativeCountryOfResidence: "FR",
Tag: "custom tag"
});
api.Users.create(legalUser).then(data => {
const d = data; // IGNORE-TEST $ExpectType UserLegalData
const value = data.PersonType; // IGNORE-TEST $ExpectType "LEGAL"
console.log(`${legalUser.Name} user created at ${legalUser.CreationDate}`);
});
api.Users.create(legalUser, { readResponseHeaders: true }).then(data => {
const d = data; // IGNORE-TEST $ExpectType WithResponse<UserLegalData>
const value = data.body; // IGNORE-TEST $ExpectType UserLegalData
});
api.Users.create(
{
PersonType: "LEGAL",
Name: "MangoPay",
Email: "info@mangopay.com",
LegalPersonType: "BUSINESS",
LegalRepresentativeFirstName: "Mango",
LegalRepresentativeLastName: "Pay",
LegalRepresentativeEmail: "mango@mangopay.com",
HeadquartersAddress: new api.models.Address({
AddressLine1: "4101 Reservoir Rd NW",
AddressLine2: "",
City: "Washington",
Region: "District of Columbia",
PostalCode: "20007",
Country: "US"
}),
LegalRepresentativeBirthday: 1300186358,
LegalRepresentativeNationality: "FR",
LegalRepresentativeCountryOfResidence: "FR",
Tag: "custom tag"
},
{ headers: {} }
).then(data => {
const d = data; // IGNORE-TEST $ExpectType UserLegalData
});
const naturalUser = new api.models.UserNatural({
Email: "info@mangopay.com",
Birthday: 1300186358,
FirstName: "Sara",
LastName: "McNick",
CountryOfResidence: "GB",
Nationality: "US"
});
api.Users.create(naturalUser, {}).then(data => {
const d = data; // IGNORE-TEST $ExpectType UserNaturalData
const value = data.PersonType; // IGNORE-TEST $ExpectType "NATURAL"
return;
});
api.Users.create(
{
PersonType: "NATURAL",
Email: "info@mangopay.com",
Birthday: 1300186358,
FirstName: "Sara",
LastName: "McNick",
CountryOfResidence: "GB",
Nationality: "US"
},
data => {
const d = data; // IGNORE-TEST $ExpectType UserNaturalData
console.log("create", data);
}
);
api.Users.get("1234").then(data => {
const d = data; // IGNORE-TEST $ExpectType UserLegalData | UserNaturalData
if (data.PersonType === "LEGAL") {
const legalData = data; // IGNORE-TEST $ExpectType UserLegalData
} else {
const naturalData = data; // IGNORE-TEST $ExpectType UserNaturalData
}
});
api.Users.getAll().then(users => {
users.forEach(user => {
const d = user; // IGNORE-TEST $ExpectType UserLegalData | UserNaturalData
if (user.PersonType === "LEGAL") {
const legalData = user; // IGNORE-TEST $ExpectType UserLegalData
} else {
const naturalData = user; // IGNORE-TEST $ExpectType UserNaturalData
}
});
});
api.Users.update({
Id: "1234",
PersonType: "NATURAL",
Email: "info@mangopay.com",
Birthday: 1300186358,
FirstName: "Sara",
LastName: "McNick",
CountryOfResidence: "GB",
Nationality: "US"
}).then(data => {
const d = data; // IGNORE-TEST $ExpectType UserNaturalData
});
api.Users.createBankAccount("user-id", {
Type: "GB",
AccountNumber: "12345678",
SortCode: "123456",
OwnerAddress: "",
OwnerName: ""
}).then(data => {
const d = data; // IGNORE-TEST $ExpectType GBData
});
api.Users.getBankAccount("user-id", "bankAccount-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType Data
});
api.Users.getBankAccounts("user-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType Data[]
});
api.Users.deactivateBankAccount("user-id", "bankAccount-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType void
});
api.Users.getTransactions("user-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType TransactionData[]
});
api.Users.getWallets("user-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType WalletData[]
});
api.Users.getCards("user-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType CardData[]
});
api.Users.createKycDocument("user-id", { Type: "ADDRESS_PROOF" }).then(data => {
const d = data; // IGNORE-TEST $ExpectType KycDocumentData
});
api.Users.getKycDocuments("user-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType KycDocumentData[]
});
api.Users.getKycDocument("user-id", "kycDocument-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType KycDocumentData
});
api.Users.updateKycDocument("user-id", { Status: "VALIDATION_ASKED" }).then(
data => {
const d = data; // IGNORE-TEST $ExpectType KycDocumentData
}
);
api.Users.createKycPage("user-id", "kycDocument-id", {
File: "...base64data..."
}).then(data => {
const d = data; // IGNORE-TEST $ExpectType KycDocumentData
});
api.Users.createKycPageFromFile(
"user-id",
"kyc-document-id",
"path/to/file"
).then(data => {
const d = data; // IGNORE-TEST $ExpectType KycDocumentData
});
// MangoPay.
api.Users.getEMoney("user-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType EMoneyData
});
api.Users.createUboDeclaration("user-id", { DeclaredUBOs: ["user1"] }).then(
data => {
const d = data; // IGNORE-TEST $ExpectType UboDeclarationData
}
);
api.Users.getPreAuthorizations("user-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType CardPreAuthorizationData[]
});
/* KycDocuments */
api.KycDocuments.getAll().then(data => {
const d = data; // IGNORE-TEST $ExpectType KycDocumentData[]
});
api.KycDocuments.get("kyc-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType KycDocumentData
});
api.KycDocuments.createKycDocumentConsult("kyc-id").then(data => {
const d = data; // TODO unsure of expected type
});
/* UboDeclarations */
api.UboDeclarations.get("ubo-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType UboDeclarationData
});
api.UboDeclarations.update({
Id: "ubo-id",
DeclaredUBOs: ["user1", "user2"]
}).then(data => {
const d = data; // IGNORE-TEST $ExpectType UboDeclarationData
});
/* BankAccounts */
api.BankAccounts.getTransactions("account-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType TransactionData[]
});
/* Wallets */
api.Wallets.create({
Currency: "GBP",
Description: "A description",
Owners: ["user-id"]
}).then(data => {
const d = data; // IGNORE-TEST $ExpectType WalletData
});
const wallet = new api.models.Wallet({
Currency: "GB",
Description: "A description",
Owners: ["user-id"]
});
api.Wallets.create(wallet).then(data => {
const d = data; // IGNORE-TEST $ExpectType WalletData
});
api.Wallets.update({
Description: "A description"
}).then(data => {
const d = data; // IGNORE-TEST $ExpectType WalletData
});
api.Wallets.get("wallet-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType WalletData
});
api.Wallets.getTransactions("wallet-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType TransactionData[]
});
/* Cards */
api.Cards.get("card-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType CardData
});
api.Cards.getByFingerprint("fingerprinthash").then(data => {
const d = data; // IGNORE-TEST $ExpectType CardData[]
});
api.Cards.update({ Active: false, Id: "card-id" }).then(data => {
const d = data; // IGNORE-TEST $ExpectType CardData
});
api.Cards.getTransactions("card-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType TransactionData[]
});
/* CardRegistrations */
api.CardRegistrations.create({
CardType: "BCMC",
Currency: "GBP",
UserId: "user-id"
}).then(data => {
const d = data; // IGNORE-TEST $ExpectType CardRegistrationData
});
api.CardRegistrations.get("reg-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType CardRegistrationData
});
api.CardRegistrations.update({ RegistrationData: "hmmm" }).then(data => {
const d = data; // IGNORE-TEST $ExpectType CardRegistrationData
});
/* CardPreAuthorizations */
api.CardPreAuthorizations.create({
AuthorId: "user",
CardId: "card-id",
DebitedFunds: { Currency: "AUD", Amount: 4000 },
SecureModeReturnURL: "https://secureurl.com"
}).then(data => {
const d = data; // IGNORE-TEST $ExpectType CardPreAuthorizationData
});
api.CardPreAuthorizations.get("auth-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType CardPreAuthorizationData
});
api.CardPreAuthorizations.update({
Id: "auth-id",
PaymentStatus: "CANCELED"
}).then(data => {
const d = data; // IGNORE-TEST $ExpectType CardPreAuthorizationData
});
/* Refunds */
api.Refunds.get("refund-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType RefundData
});
/* PayIns */
api.PayIns.create({
PaymentType: "CARD",
ExecutionType: "DIRECT",
AuthorId: "user-id",
CardId: "card-id",
CreditedWalletId: "wallet-id",
Fees: { Amount: 100, Currency: "GBP" },
DebitedFunds: { Amount: 2000, Currency: "GBP" },
SecureModeReturnURL: "https://secure-return.co"
}).then(data => {
const d = data; // IGNORE-TEST $ExpectType CardDirectPayInData
});
api.PayIns.create({
PaymentType: "CARD",
ExecutionType: "WEB",
AuthorId: "user-id",
CreditedWalletId: "wallet-id",
Fees: { Amount: 100, Currency: "GBP" },
DebitedFunds: { Amount: 2000, Currency: "GBP" },
ReturnURL: "https://secure-return.co",
Culture: "AD",
CardType: "MAESTRO"
}).then(data => {
const d = data; // IGNORE-TEST $ExpectType CardWebPayInData
});
api.PayIns.create({
PaymentType: "BANK_WIRE",
ExecutionType: "DIRECT",
AuthorId: "user-id",
CreditedWalletId: "wallet-id",
CreditedUserId: "credited-user-id",
DeclaredDebitedFunds: { Amount: 10000, Currency: "GBP" },
DeclaredFees: { Amount: 500, Currency: "GBP" }
}).then(data => {
const d = data; // IGNORE-TEST $ExpectType BankWireDirectPayInData
});
api.PayIns.get("payin-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType PayInData
});
api.PayIns.createRefund("payin-id", { AuthorId: "user-id" }).then(data => {
const d = data; // IGNORE-TEST $ExpectType RefundData
});
api.PayIns.getRefunds("payin-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType RefundData[]
});
/* Clients */
api.Clients.get().then(data => {
const d = data; // IGNORE-TEST $ExpectType ClientData
});
api.Clients.update({ PlatformType: "CROWDFUNDING_DONATION" }).then(data => {
const d = data; // IGNORE-TEST $ExpectType ClientData
});
api.Clients.uploadLogo("...logobase64...").then(data => {
const d = data; // IGNORE-TEST $ExpectType ClientData
});
api.Clients.uploadLogoFromFile("path/to/file").then(data => {
const d = data; // IGNORE-TEST $ExpectType ClientData
});
api.Clients.getClientWallets().then(data => {
const d = data; // IGNORE-TEST $ExpectType ClientWalletData[]
});
api.Clients.getClientWallet("CREDIT", "GBP").then(data => {
const d = data; // IGNORE-TEST $ExpectType ClientWalletData
});
api.Clients.getClientWalletsByFundsType("FEES").then(data => {
const d = data; // IGNORE-TEST $ExpectType ClientWalletData[]
});
api.Clients.getClientWalletTransactions("CREDIT", "GBP").then(data => {
const d = data; // IGNORE-TEST $ExpectType TransactionData[]
});
/* PayOuts */
api.PayOuts.create({
Fees: { Amount: 0, Currency: "GBP" },
AuthorId: "user-id",
DebitedFunds: { Amount: 2000, Currency: "GBP" },
BankAccountId: "bank-id",
DebitedWalletId: "wallet-id"
}).then(data => {
const d = data; // IGNORE-TEST $ExpectType PayOutData
});
api.PayOuts.get("payout-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType PayOutData
});
api.PayOuts.getRefunds("payout-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType RefundData[]
});
/* Transfers */
api.Transfers.create({
Fees: { Amount: 0, Currency: "GBP" },
AuthorId: "user-id",
DebitedFunds: { Amount: 2000, Currency: "GBP" },
DebitedWalletId: "debit-wallet-id",
CreditedWalletId: "credit-wallet-id"
}).then(data => {
const d = data; // IGNORE-TEST $ExpectType TransferData
});
api.Transfers.get("transfer-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType TransferData
});
api.Transfers.createRefund("transfer-id", { AuthorId: "user-id" }).then(
data => {
const d = data; // IGNORE-TEST $ExpectType RefundData
}
);
api.Transfers.getRefunds("transfer-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType RefundData[]
});
/* BankingAliases */
api.BankingAliases.create({
Country: "GB",
CreditedUserId: "user-id",
OwnerName: "owner-id"
}).then(data => {
const d = data; // IGNORE-TEST $ExpectType IBANBankingAliasData
});
api.BankingAliases.get("alias-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType IBANBankingAliasData
});
api.BankingAliases.getAll().then(data => {
const d = data; // IGNORE-TEST $ExpectType IBANBankingAliasData[]
});
api.BankingAliases.update({ OwnerName: "some-name" }).then(data => {
const d = data; // IGNORE-TEST $ExpectType IBANBankingAliasData
});
api.BankingAliases.deactivate("alias-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType IBANBankingAliasData
});
api.BankingAliases.activate("alias-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType IBANBankingAliasData
});
/* DisputeDocuments */
api.DisputeDocuments.getAll().then(data => {
const d = data; // IGNORE-TEST $ExpectType DisputeDocumentData[]
});
api.DisputeDocuments.get("dispute-doc-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType DisputeDocumentData
});
api.DisputeDocuments.createDisputeDocumentConsult("dispute-doc-id").then(
data => {
const d = data; // TODO unsure of expected type
}
);
/* Repudiations */
api.Repudiations.getRefunds("repudiation-id").then(data => {
const d = data; // $Expect RefundData[]
});
/* Disputes */
api.Disputes.get("dispute-id").then(data => {
const d = data; // $Expect DisputeData
});
api.Disputes.getAll().then(data => {
const d = data; // $Expect DisputeData[]
});
api.Disputes.update({ Tag: "any tags" }).then(data => {
const d = data; // $Expect DisputeData
});
api.Disputes.contestDispute("dispute-id", {
Amount: 1000,
Currency: "GBP"
}).then(data => {
const d = data; // $Expect DisputeData
});
api.Disputes.resubmitDispute("dispute-id").then(data => {
const d = data; // $Expect DisputeData
});
api.Disputes.closeDispute("dispute-id").then(data => {
const d = data; // $Expect DisputeData
});
api.Disputes.getTransactions("dispute-id").then(data => {
const d = data; // $Expect TransactionData[]
});
api.Disputes.getDisputesForWallet("wallet-id").then(data => {
const d = data; // $Expect DisputeData[]
});
api.Disputes.getDisputesForUser("user-id").then(data => {
const d = data; // $Expect DisputeData[]
});
api.Disputes.getRepudiation("repudiation-id").then(data => {
const d = data; // $Expect RepudationData
});
api.Disputes.createSettlementTransfer(
{
AuthorId: "user-id",
DebitedFunds: { Amount: 1000, Currency: "GBP" },
Fees: { Amount: 200, Currency: "GBP" }
},
"repudiation-id"
).then(data => {
const d = data; // $Expect DisputeData
});
api.Disputes.getSettlementTransfer("settlement-id").then(data => {
const d = data; // $Expect DisputeData
});
api.Disputes.getDocumentsForDispute("dispute-id").then(data => {
const d = data; // $Expect DisputeDocumentData[]
});
api.Disputes.updateDisputeDocument("dispute-id", { Tag: "update" }).then(
data => {
const d = data; // $Expect DisputeDocumentData
}
);
api.Disputes.createDisputeDocument("dispute-id", {
Type: "DELIVERY_PROOF"
}).then(data => {
const d = data; // $Expect DisputeData
});
api.Disputes.createDisputeDocumentPage("dispute-id", "dispute-doc-id", {
File: "...base64string..."
}).then(data => {
const d = data; // $Expect DisputeData
});
api.Disputes.createDisputeDocumentPageFromFile(
"dispute-id",
"dispute-doc-id",
"path/to/file"
).then(data => {
const d = data; // $Expect DisputeData
});
api.Disputes.getPendingSettlement().then(data => {
const d = data; // $Expect DisputeData
});
/* Events */
api.Events.getAll().then(data => {
const d = data; // $Expect EventData[]
});
/* Responses */
api.Responses.get().then(data => {
const d = data; // IGNORE-TEST $ExpectType any[]
});
/* Mandates */
api.Mandates.create({
BankAccountId: "bank-account-id",
ReturnURL: "https://return-url.com",
Culture: "EN"
}).then(data => {
const d = data; // IGNORE-TEST $ExpectType MandateData
});
api.Mandates.getAll().then(data => {
const d = data; // IGNORE-TEST $ExpectType MandateData[]
});
api.Mandates.get("mandate-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType MandateData
});
api.Mandates.cancel("mandate-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType MandateData
});
api.Mandates.getMandatesForUser("user-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType MandateData[]
});
api.Mandates.getMandatesForBankAccount("user-id", "bank-account-id").then(
data => {
const d = data; // IGNORE-TEST $ExpectType MandateData[]
}
);
api.Mandates.getTransactions("mandate-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType TransactionData[]
});
/* Hooks */
api.Hooks.create({
Url: "https://hook-url.com",
EventType: "DISPUTE_ACTION_REQUIRED"
}).then(data => {
const d = data; // IGNORE-TEST $ExpectType HookData
});
api.Hooks.get("hook-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType HookData
});
api.Hooks.update({ Id: "hook-id", Url: "https://new-hook.com/hooks" }).then(
data => {
const d = data; // IGNORE-TEST $ExpectType HookData
}
);
api.Hooks.getAll().then(data => {
const d = data; // IGNORE-TEST $ExpectType HookData[]
});
/* Reports */
api.Reports.create({ Columns: ["Alias", "AuthorId"] }).then(data => {
const d = data; // IGNORE-TEST $ExpectType ReportData
});
api.Reports.get("report-id").then(data => {
const d = data; // IGNORE-TEST $ExpectType ReportData
});
api.Reports.getAll().then(data => {
const d = data; // IGNORE-TEST $ExpectType ReportData[]
});

View File

@@ -0,0 +1,20 @@
{
"compilerOptions": {
"module": "commonjs",
"noEmit": true,
"lib": ["es6"],
"noUnusedLocals": false,
"noUnusedParameters": false,
"forceConsistentCasingInFileNames": true,
"experimentalDecorators": true,
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"types": [],
"typeRoots": ["../"]
},
"files": ["index.d.ts", "types.d.ts", "mangopay2-nodejs-sdk-tests.ts"]
}

View File

@@ -0,0 +1,10 @@
{
"extends": "dtslint/dt.json",
"rules": {
"no-redundant-jsdoc": false,
"no-misused-new": false,
"no-empty-interface": false,
"interface-name": false,
"no-unnecessary-class": false
}
}

565
types/mangopay2-nodejs-sdk/types.d.ts vendored Normal file
View File

@@ -0,0 +1,565 @@
/**
* Makes specified keys of an interface Optional.
*/
export type MakeKeysOptional<T1, T2 extends keyof T1> = Omit<T1, T2> &
Partial<Pick<T1, T2>>;
export type PickPartial<T, Par extends keyof T> = Pick<Partial<T>, Par>;
export type PickPartialRequired<
T,
Par extends keyof T,
Req extends keyof T
> = Pick<Partial<T>, Par> & Pick<Required<T>, Req>;
export type DeepPartial<T> = { [P in keyof T]?: DeepPartial<T[P]> };
/**
* Makes specified keys of an interface nullable.
*/
export type MakeKeysNullable<T1, T2 extends keyof T1> = Omit<T1, T2> &
{ [P in T2]: T1[P] | null };
/**
* Makes specified keys of an interface Required.
*/
export type MakeKeysRequired<T1, T2 extends keyof T1> = Omit<T1, T2> &
Required<Pick<T1, T2>>;
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
export type OmitType<T extends { Type: string }> = Omit<T, "Type">;
export type ValueOf<T> = T[keyof T];
export type ApiMethod =
| "authentication_oauth"
| "responses_get"
| "events_all"
| "hooks_create"
| "hooks_all"
| "hooks_get"
| "hooks_save"
| "cardregistration_create"
| "cardregistration_get"
| "cardregistration_save"
| "preauthorization_create"
| "preauthorization_get"
| "preauthorization_save"
| "preauthorizations_get_for_user"
| "card_get"
| "cards_get_by_fingerprint"
| "card_save"
| "card_get_preauthorizations"
| "payins_card-web_create"
| "payins_card-direct_create"
| "payins_preauthorized-direct_create"
| "payins_bankwire-direct_create"
| "payins_directdebit-web_create"
| "payins_directdebit-direct_create"
| "payins_paypal-web_create"
| "payins_get"
| "payins_createrefunds"
| "payouts_bankwire_create"
| "payouts_get"
| "refunds_get"
| "refunds_get_for_repudiation"
| "refunds_get_for_transfer"
| "refunds_get_for_payin"
| "refunds_get_for_payout"
| "transfers_create"
| "transfers_get"
| "transfers_createrefunds"
| "users_createnaturals"
| "users_createlegals"
| "users_createbankaccounts_iban"
| "users_createbankaccounts_gb"
| "users_createbankaccounts_us"
| "users_createbankaccounts_ca"
| "users_createbankaccounts_other"
| "users_all"
| "users_allwallets"
| "users_allbankaccount"
| "users_allcards"
| "users_alltransactions"
| "users_allkycdocuments"
| "users_get"
| "users_getnaturals"
| "users_getlegals"
| "users_getbankaccount"
| "users_deactivate_bankaccount"
| "users_savenaturals"
| "users_savelegals"
| "users_getemoney"
| "wallets_create"
| "wallets_alltransactions"
| "wallets_get"
| "wallets_save"
| "kyc_documents_create"
| "kyc_documents_get"
| "kyc_documents_save"
| "kyc_page_create"
| "kyc_documents_all"
| "kyc_documents_get_alt"
| "kyc_documents_create_consult"
| "disputes_get"
| "disputes_save_tag"
| "disputes_save_contest_funds"
| "dispute_save_close"
| "disputes_get_transactions"
| "disputes_all"
| "disputes_get_for_wallet"
| "disputes_get_for_user"
| "disputes_document_create"
| "disputes_document_page_create"
| "disputes_document_save"
| "disputes_document_get"
| "disputes_document_get_for_dispute"
| "disputes_document_all"
| "disputes_document_create_consult"
| "disputes_repudiation_get"
| "disputes_repudiation_create_settlement"
| "disputes_repudiation_get_settlement"
| "disputes_pending_settlement"
| "reports_transaction_create"
| "reports_wallet_create"
| "reports_get"
| "reports_all"
| "mandates_directdebit-web_create"
| "mandates_get"
| "mandates_cancel"
| "mandates_all"
| "mandates_get_for_user"
| "mandates_get_for_bank_account"
| "clients_get"
| "clients_update"
| "clients_upload_logo"
| "client_wallets_all"
| "client_wallets_get"
| "client_wallets_by_fundsType"
| "client_wallets_transactions"
| "banking_aliases_iban_create"
| "banking_aliases_get"
| "banking_aliases_update"
| "banking_aliases_all"
| "ubo_declaration_create"
| "ubo_declaration_update"
| "ubo_declaration_get"
| "transactions_get_for_mandate"
| "transactions_get_for_card"
| "transactions_get_for_bank_account";
export type CountryISO =
| "AD"
| "AE"
| "AF"
| "AG"
| "AI"
| "AL"
| "AM"
| "AO"
| "AQ"
| "AR"
| "AS"
| "AT"
| "AU"
| "AW"
| "AX"
| "AZ"
| "BA"
| "BB"
| "BD"
| "BE"
| "BF"
| "BG"
| "BH"
| "BI"
| "BJ"
| "BL"
| "BM"
| "BN"
| "BO"
| "BQ"
| "BR"
| "BS"
| "BT"
| "BV"
| "BW"
| "BY"
| "BZ"
| "CA"
| "CC"
| "CD"
| "CF"
| "CG"
| "CH"
| "CI"
| "CK"
| "CL"
| "CM"
| "CN"
| "CO"
| "CR"
| "CU"
| "CV"
| "CW"
| "CX"
| "CY"
| "CZ"
| "DE"
| "DJ"
| "DK"
| "DM"
| "DO"
| "DZ"
| "EC"
| "EE"
| "EG"
| "EH"
| "ER"
| "ES"
| "ET"
| "FI"
| "FJ"
| "FK"
| "FM"
| "FO"
| "FR"
| "GA"
| "GB"
| "GD"
| "GE"
| "GF"
| "GG"
| "GH"
| "GI"
| "GL"
| "GM"
| "GN"
| "GP"
| "GQ"
| "GR"
| "GS"
| "GT"
| "GU"
| "GW"
| "GY"
| "HK"
| "HM"
| "HN"
| "HR"
| "HT"
| "HU"
| "ID"
| "IE"
| "IL"
| "IM"
| "IN"
| "IO"
| "IQ"
| "IR"
| "IS"
| "IT"
| "JE"
| "JM"
| "JO"
| "JP"
| "KE"
| "KG"
| "KH"
| "KI"
| "KM"
| "KN"
| "KP"
| "KR"
| "KW"
| "KY"
| "KZ"
| "LA"
| "LB"
| "LC"
| "LI"
| "LK"
| "LR"
| "LS"
| "LT"
| "LU"
| "LV"
| "LY"
| "MA"
| "MC"
| "MD"
| "ME"
| "MF"
| "MG"
| "MH"
| "MK"
| "ML"
| "MM"
| "MN"
| "MO"
| "MP"
| "MQ"
| "MR"
| "MS"
| "MT"
| "MU"
| "MV"
| "MW"
| "MX"
| "MY"
| "MZ"
| "NA"
| "NC"
| "NE"
| "NF"
| "NG"
| "NI"
| "NL"
| "NO"
| "NP"
| "NR"
| "NU"
| "NZ"
| "OM"
| "PA"
| "PE"
| "PF"
| "PG"
| "PH"
| "PK"
| "PL"
| "PM"
| "PN"
| "PR"
| "PS"
| "PT"
| "PW"
| "PY"
| "QA"
| "RE"
| "RO"
| "RS"
| "RU"
| "RW"
| "SA"
| "SB"
| "SC"
| "SD"
| "SE"
| "SG"
| "SH"
| "SI"
| "SJ"
| "SK"
| "SL"
| "SM"
| "SN"
| "SO"
| "SR"
| "SS"
| "ST"
| "SV"
| "SX"
| "SY"
| "SZ"
| "TC"
| "TD"
| "TF"
| "TG"
| "TH"
| "TJ"
| "TK"
| "TL"
| "TM"
| "TN"
| "TO"
| "TR"
| "TT"
| "TV"
| "TW"
| "TZ"
| "UA"
| "UG"
| "UM"
| "US"
| "UY"
| "UZ"
| "VA"
| "VC"
| "VE"
| "VG"
| "VI"
| "VN"
| "VU"
| "WF"
| "WS"
| "YE"
| "YT"
| "ZA"
| "ZM"
| "ZW";
export type CurrencyISO =
| "AED"
| "AFN"
| "ALL"
| "AMD"
| "ANG"
| "AOA"
| "ARS"
| "AUD"
| "AWG"
| "AZN"
| "BAM"
| "BBD"
| "BDT"
| "BGN"
| "BHD"
| "BIF"
| "BMD"
| "BND"
| "BOB"
| "BRL"
| "BSD"
| "BTN"
| "BWP"
| "BYN"
| "BZD"
| "CAD"
| "CDF"
| "CHF"
| "CLP"
| "CNY"
| "COP"
| "CRC"
| "CUC"
| "CUP"
| "CVE"
| "CZK"
| "DJF"
| "DKK"
| "DOP"
| "DZD"
| "EGP"
| "ERN"
| "ETB"
| "EUR"
| "FJD"
| "FKP"
| "GBP"
| "GEL"
| "GGP"
| "GHS"
| "GIP"
| "GMD"
| "GNF"
| "GTQ"
| "GYD"
| "HKD"
| "HNL"
| "HRK"
| "HTG"
| "HUF"
| "IDR"
| "ILS"
| "IMP"
| "INR"
| "IQD"
| "IRR"
| "ISK"
| "JEP"
| "JMD"
| "JOD"
| "JPY"
| "KES"
| "KGS"
| "KHR"
| "KMF"
| "KPW"
| "KRW"
| "KWD"
| "KYD"
| "KZT"
| "LAK"
| "LBP"
| "LKR"
| "LRD"
| "LSL"
| "LYD"
| "MAD"
| "MDL"
| "MGA"
| "MKD"
| "MMK"
| "MNT"
| "MOP"
| "MRU"
| "MUR"
| "MVR"
| "MWK"
| "MXN"
| "MYR"
| "MZN"
| "NAD"
| "NGN"
| "NIO"
| "NOK"
| "NPR"
| "NZD"
| "OMR"
| "PAB"
| "PEN"
| "PGK"
| "PHP"
| "PKR"
| "PLN"
| "PYG"
| "QAR"
| "RON"
| "RSD"
| "RUB"
| "RWF"
| "SAR"
| "SBD"
| "SCR"
| "SDG"
| "SEK"
| "SGD"
| "SHP"
| "SLL"
| "SOS"
| "SPL"
| "SRD"
| "STN"
| "SVC"
| "SYP"
| "SZL"
| "THB"
| "TJS"
| "TMT"
| "TND"
| "TOP"
| "TRY"
| "TTD"
| "TVD"
| "TWD"
| "TZS"
| "UAH"
| "UGX"
| "USD"
| "UYU"
| "UZS"
| "VEF"
| "VND"
| "VUV"
| "WST"
| "XAF"
| "XCD"
| "XDR"
| "XOF"
| "XPF"
| "YER"
| "ZAR"
| "ZMW"
| "ZWD";

View File

@@ -1,4 +1,4 @@
// Type definitions for @mapbox/geo-viewport 0.3
// Type definitions for @mapbox/geo-viewport 0.4
// Project: https://github.com/mapbox/geo-viewport
// Definitions by: Fabio Berta <https://github.com/fnberta>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -10,6 +10,6 @@ export interface GeoViewport {
export type BoundingBox = [number, number, number, number];
export function viewport(bounds: BoundingBox, dimensions: [number, number], minzoom?: number, maxzoom?: number, tileSize?: number): GeoViewport;
export function viewport(bounds: BoundingBox, dimensions: [number, number], minzoom?: number, maxzoom?: number, tileSize?: number, allowFloat?: boolean): GeoViewport;
export function bounds(viewport: { lon: number; lat: number } | [number, number], zoom: number, dimensions: [number, number], tileSize?: number): BoundingBox;

8
types/mnemonic-words/index.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
// Type definitions for mnemonic-words 1.0
// Project: https://github.com/sindresorhus/mnemonic-words#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = mnemonicWords;
declare const mnemonicWords: string[];

View File

@@ -0,0 +1,5 @@
import mnemonicWords = require('mnemonic-words');
import mnemonicWordsJson = require('mnemonic-words/words.json');
mnemonicWords; // $ExpectType string[]
mnemonicWordsJson; // $ExpectType string[]

View File

@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true
},
"files": [
"index.d.ts",
"words.json.d.ts",
"mnemonic-words-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

3
types/mnemonic-words/words.json.d.ts vendored Normal file
View File

@@ -0,0 +1,3 @@
export = mnemonicWords;
declare const mnemonicWords: string[];

81
types/new-github-issue-url/index.d.ts vendored Normal file
View File

@@ -0,0 +1,81 @@
// Type definitions for new-github-issue-url 0.1
// Project: https://github.com/sindresorhus/new-github-issue-url#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
export = newGithubIssueUrl;
/**
* Returns a URL string.
*/
declare function newGithubIssueUrl(options: newGithubIssueUrl.Options): string;
declare namespace newGithubIssueUrl {
type Without<T, U> = { [P in Exclude<keyof T, keyof U>]?: never };
type XOR<T, U> = (T | U) extends object ? (Without<T, U> & U) | (Without<U, T> & T) : T | U;
type Options = XOR<RepoUrlOptions, UserRepoOptions>;
interface BaseOptions {
/**
* The issue body.
*/
body?: string;
/**
* The issue title.
*/
title?: string;
/**
* Use an [issue template](https://help.github.com/articles/manually-creating-a-single-issue-template-for-your-repository).
*
* For example, if you want to use a template at `ISSUE_TEMPLATE/unicorn.md`, you would specify `unicorn.md` here.
*/
template?: string;
/**
* The labels for the issue.
*
* *Requires the user to have the permission to add labels.*
*/
labels?: string[];
/**
* The milestone for the issue.
*
* *Requires the user to have the permission to add milestone.*
*/
milestone?: string;
/**
* The user to assign to the issue.
*
* *Requires the user to have the permission to add assignee.*
*/
assignee?: string;
/**
* The projects to add the issue to.
*
* The project reference format is `user/<project-number>`, for example, if the URL to the project
* is `https://github.com/sindresorhus/some-repo/projects/3`, the project reference would be `some-repo/3`.
*
* *Requires the user to have the permission to add projects.*
*/
projects?: string[];
}
interface RepoUrlOptions extends BaseOptions {
/**
* The full URL to the repo.
*/
repoUrl: string;
}
interface UserRepoOptions extends BaseOptions {
/**
* GitHub username or organization.
*/
user: string;
/**
* GitHub repo.
*/
repo: string;
}
}

View File

@@ -0,0 +1,54 @@
import newGithubIssueUrl = require('new-github-issue-url');
// $ExpectType string
newGithubIssueUrl({
repoUrl: 'https://github.com/sindresorhus/new-github-issue-url.git',
});
// $ExpectType string
newGithubIssueUrl({
user: 'sindresorhus',
repo: 'new-github-issue-url',
});
// $ExpectError
newGithubIssueUrl({
user: 'sindresorhus',
});
// $ExpectError
newGithubIssueUrl({
repo: 'new-github-issue-url',
});
// $ExpectType string
newGithubIssueUrl({
repoUrl: 'https://github.com/sindresorhus/new-github-release-url.git',
body: 'foo',
});
// $ExpectType string
newGithubIssueUrl({
repoUrl: 'https://github.com/sindresorhus/new-github-release-url.git',
title: 'foo',
});
// $ExpectType string
newGithubIssueUrl({
repoUrl: 'https://github.com/sindresorhus/new-github-release-url.git',
template: 'unicorn.md',
});
// $ExpectType string
newGithubIssueUrl({
repoUrl: 'https://github.com/sindresorhus/new-github-release-url.git',
labels: ['foo', 'bar'],
});
// $ExpectType string
newGithubIssueUrl({
repoUrl: 'https://github.com/sindresorhus/new-github-release-url.git',
milestone: 'foo',
});
// $ExpectType string
newGithubIssueUrl({
repoUrl: 'https://github.com/sindresorhus/new-github-release-url.git',
assignee: 'sindresorhus',
});
// $ExpectType string
newGithubIssueUrl({
repoUrl: 'https://github.com/sindresorhus/new-github-release-url.git',
projects: ['some-repo/3'],
});

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",
"new-github-issue-url-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

14
types/npm-email/index.d.ts vendored Normal file
View File

@@ -0,0 +1,14 @@
// Type definitions for npm-email 3.0
// Project: https://github.com/sindresorhus/npm-email#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = npmEmail;
/**
* Get the email of an npm user.
*
* @param username npm username to look up.
* @returns A promise for the user's email address.
*/
declare function npmEmail(username: string): Promise<string>;

View File

@@ -0,0 +1,3 @@
import npmEmail = require('npm-email');
npmEmail('sindresorhus'); // $ExpectType Promise<string>

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",
"npm-email-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

44
types/npm-keyword/index.d.ts vendored Normal file
View File

@@ -0,0 +1,44 @@
// Type definitions for npm-keyword 5.0
// Project: https://github.com/sindresorhus/npm-keyword#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = npmKeyword;
/**
* Get a list of npm packages with a certain keyword.
*
* @param keyword One or more keywords. Only matches packages that have *all* the given keywords. Example: `['string', 'camelcase']`
* @returns A promise for a list of packages having the specified keyword in their package.json `keyword` property.
*/
declare function npmKeyword(
keyword: string | string[],
options?: npmKeyword.Options
): Promise<npmKeyword.PackageDescriptor[]>;
declare namespace npmKeyword {
/**
* @param keyword One or more keywords. Only matches packages that have *all* the given keywords. Example: `['string', 'camelcase']`
* @returns A promise for a list of package names. Use this if you don't need the description as it's faster.
*/
function names(keyword: string | string[], options?: Options): Promise<string[]>;
/**
* @param keyword One or more keywords. Only matches packages that have *all* the given keywords. Example: `['string', 'camelcase']`
* @returns A promise for the count of packages.
*/
function count(keyword: string | string[]): Promise<number>;
interface Options {
/**
* Limits the amount of results.
* @default 250
*/
size?: number;
}
interface PackageDescriptor {
name: string;
description: string;
}
}

View File

@@ -0,0 +1,7 @@
import npmKeyword = require('npm-keyword');
npmKeyword('gulpplugin'); // $ExpectType Promise<PackageDescriptor[]>
npmKeyword('gulpplugin', { size: 10 }); // $ExpectType Promise<PackageDescriptor[]>
npmKeyword.names('gulpplugin'); // $ExpectType Promise<string[]>
npmKeyword.names('gulpplugin', { size: 10 }); // $ExpectType Promise<string[]>
npmKeyword.count('gulpplugin'); // $ExpectType Promise<number>

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",
"npm-keyword-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

45
types/npm-run-path/index.d.ts vendored Normal file
View File

@@ -0,0 +1,45 @@
// Type definitions for npm-run-path 2.0
// Project: https://github.com/sindresorhus/npm-run-path#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = npmRunPath;
/**
* Get your [PATH](https://en.wikipedia.org/wiki/PATH_(variable)) prepended with locally installed binaries.
*/
declare function npmRunPath(options?: npmRunPath.Options): string;
declare namespace npmRunPath {
function env(options?: EnvOptions): ProcessEnv;
interface Options {
/**
* Working directory.
*/
cwd?: string;
/**
* PATH to be appended.
* Set it to an empty string to exclude the default [PATH](https://github.com/sindresorhus/path-key).
* @default PATH
*/
path?: string;
}
interface EnvOptions {
/**
* Working directory.
*/
cwd?: string;
/**
* Accepts an object of environment variables, like `process.env`, and modifies the PATH using the correct
* [PATH key](https://github.com/sindresorhus/path-key). Use this if you're modifying the PATH for use
* in the `child_process` options.
*/
env?: ProcessEnv;
}
interface ProcessEnv {
[key: string]: string | undefined;
}
}

View File

@@ -0,0 +1,16 @@
/// <reference types="node" />
import childProcess = require('child_process');
import npmRunPath = require('npm-run-path');
npmRunPath(); // $ExpectType string
npmRunPath({ cwd: '/foo' }); // $ExpectType string
npmRunPath({ path: '/usr/local/bin' }); // $ExpectType string
npmRunPath.env(); // $ExpectType ProcessEnv
npmRunPath.env({ cwd: '/foo' }); // $ExpectType ProcessEnv
npmRunPath.env({ env: process.env }); // $ExpectType ProcessEnv
childProcess.execFileSync('foo', {
env: npmRunPath.env(),
});

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",
"npm-run-path-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

43
types/npm-user-packages/index.d.ts vendored Normal file
View File

@@ -0,0 +1,43 @@
// Type definitions for npm-user-packages 3.0
// Project: https://github.com/kevva/npm-user-packages#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = npmUserPackages;
/**
* Get packages by a npm user.
* @param username User to fetch packages from.
*/
declare function npmUserPackages(username: string): Promise<npmUserPackages.PackageData[]>;
declare namespace npmUserPackages {
interface PackageData {
author: {
email?: string;
name: string;
url?: string;
username?: string;
};
date: string;
description: string;
keywords: string[];
links: {
bugs?: string;
homepage?: string;
npm: string;
repository?: string;
};
maintainers: Array<{
email: string;
username: string;
}>;
name: string;
publisher: {
email: string;
username: string;
};
scope: string;
version: string;
}
}

View File

@@ -0,0 +1,3 @@
import npmUserPackages = require('npm-user-packages');
npmUserPackages('kevva'); // $ExpectType Promise<PackageData[]>

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",
"npm-user-packages-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

18
types/npm-user/index.d.ts vendored Normal file
View File

@@ -0,0 +1,18 @@
// Type definitions for npm-user 3.0
// Project: https://github.com/sindresorhus/npm-user#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = npmUser;
declare function npmUser(name: string): Promise<npmUser.UserData>;
declare namespace npmUser {
interface UserData {
name: string | null;
avatar: string | null;
email: string | null;
github: string | null;
twitter: string | null;
}
}

View File

@@ -0,0 +1,11 @@
import npmUser = require('npm-user');
npmUser('sindresorhus').then(user => {
user; // $ExpectType UserData
user.name; // $ExpectType string | null
user.avatar; // $ExpectType string | null
user.email; // $ExpectType string | null
user.github; // $ExpectType string | null
user.twitter; // $ExpectType string | null
});

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",
"npm-user-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

File diff suppressed because it is too large Load Diff

8
types/pkg-versions/index.d.ts vendored Normal file
View File

@@ -0,0 +1,8 @@
// Type definitions for pkg-versions 1.1
// Project: https://github.com/sindresorhus/pkg-versions#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = pkgVersions;
declare function pkgVersions(name: string): Promise<Set<string>>;

View File

@@ -0,0 +1,3 @@
import pkgVersions = require('pkg-versions');
pkgVersions('ava'); // $ExpectType Promise<Set<string>>

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",
"pkg-versions-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -0,0 +1,9 @@
// Type definitions for react-lifecycles-compat 3.0
// Project: https://github.com/reactjs/react-lifecycles-compat#readme
// Definitions by: bySabi Files <https://github.com/bySabi>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.8
import * as React from 'react';
export function polyfill<P>(Comp: React.ComponentType<P>): React.ComponentType<P>;

View File

@@ -0,0 +1,10 @@
import * as React from 'react';
import { polyfill } from 'react-lifecycles-compat';
class A extends React.Component {
render() {
return null;
}
}
const Comp = polyfill(A);

View File

@@ -0,0 +1,24 @@
{
"compilerOptions": {
"module": "commonjs",
"lib": [
"es6"
],
"noImplicitAny": true,
"noImplicitThis": true,
"strictNullChecks": true,
"strictFunctionTypes": true,
"baseUrl": "../",
"typeRoots": [
"../"
],
"types": [],
"noEmit": true,
"forceConsistentCasingInFileNames": true,
"jsx": "preserve"
},
"files": [
"index.d.ts",
"react-lifecycles-compat-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -4,7 +4,6 @@
// John Gunther <https://github.com/guntherjh>
// Konstantin Nesterov <https://github.com/wasd171>
// Szőke Szabolcs <https://github.com/szabolcsx>
// Kræn Hansen <https://github.com/kraenhansen>
// Steve Zhang <https://github.com/Stevearzh>
// Maciej Goszczycki <https://github.com/mgoszcz2>
// Brandon Hall <https://github.com/brandonhall>

9
types/rgb-hex/index.d.ts vendored Normal file
View File

@@ -0,0 +1,9 @@
// Type definitions for rgb-hex 2.1
// Project: https://github.com/sindresorhus/rgb-hex#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = rgbHex;
declare function rgbHex(rgba: string): string;
declare function rgbHex(red: number, green: number, blue: number, alpha?: string | number): string;

View File

@@ -0,0 +1,6 @@
import rgbHex = require('rgb-hex');
rgbHex('rgb(40, 42, 54)'); // $ExpectType string
rgbHex(65, 131, 196); // $ExpectType string
rgbHex(65, 131, 196, 0.2); // $ExpectType string
rgbHex(40, 42, 54, '75%'); // $ExpectType string

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",
"rgb-hex-tests.ts"
]
}

View File

@@ -0,0 +1 @@
{ "extends": "dtslint/dt.json" }

View File

@@ -340,11 +340,12 @@ declare namespace Showdown {
/**
* Converts an HTML string into a markdown string
* @param src
*
* @param src The input text (HTML)
* @param [HTMLParser] A WHATWG DOM and HTML parser, such as JSDOM. If none is supplied, window.document will be used.
* @returns {string}
* @returns The output markdown
*/
makeMarkdown(src: string, HTMLParser?: any): string;
makeMarkdown(src: string, HTMLParser?: HTMLDocument): string;
/**
* Setting a "local" option only affects the specified Converter object.

View File

@@ -1,4 +1,4 @@
// Type definitions for simpl-schema 0.1
// Type definitions for simpl-schema 0.2
// Project: https://github.com/aldeed/simple-schema-js
// Definitions by: Andreas Richter <https://github.com/arichter83>
// Qkramer <https://github.com/Qkramer>
@@ -135,6 +135,7 @@ interface SimpleSchemaStatic {
objectKeys(keyPrefix: any): any[];
validate(obj: any, options?: ValidationOption): void;
validator(options?: ValidationOption): () => boolean;
extendOptions(options: string[]): void;
RegEx: {
Email: RegExp;
EmailWithTLD: RegExp;
@@ -236,7 +237,6 @@ export interface SimpleSchema extends SimpleSchemaStatic {
/** Validate a data object. Options: {keys: []} to limit */
validate(obj: any, options?: ValidationOption): void;
addValidator(validator: () => boolean): any;
extendOptions(options: {[key: string]: any}): void;
messages(messages: any): void;
}

View File

@@ -81,3 +81,5 @@ new SimpleSchema({
shortArray: Array,
subSchema: StringSchemaWithOptions
});
SimpleSchema.extendOptions(['autoform']);

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