Merge pull request #34525 from BendingBender/remove-upstreamed-types

Deprecate types for packages that provide their own types
This commit is contained in:
Benjamin Lichtman
2019-04-10 10:53:02 -07:00
committed by GitHub
169 changed files with 240 additions and 2560 deletions

View File

@@ -30,6 +30,18 @@
"sourceRepoURL": "https://github.com/epoberezkin/ajv",
"asOfVersion": "1.0.0"
},
{
"libraryName": "all-keys",
"typingsPackageName": "all-keys",
"sourceRepoURL": "https://github.com/sindresorhus/all-keys",
"asOfVersion": "3.0.0"
},
{
"libraryName": "all-keys",
"typingsPackageName": "all-property-names",
"sourceRepoURL": "https://github.com/sindresorhus/all-keys",
"asOfVersion": "3.0.0"
},
{
"libraryName": "angular-touchspin",
"typingsPackageName": "angular-touchspin",
@@ -48,6 +60,12 @@
"sourceRepoURL": "https://github.com/nonplus/angular-ui-router-uib-modal",
"asOfVersion": "0.0.11"
},
{
"libraryName": "ansi-escapes",
"typingsPackageName": "ansi-escapes",
"sourceRepoURL": "https://github.com/sindresorhus/ansi-escapes",
"asOfVersion": "4.0.0"
},
{
"libraryName": "antd",
"typingsPackageName": "antd",
@@ -84,6 +102,24 @@
"sourceRepoURL": "https://github.com/ranisalt/node-argon2",
"asOfVersion": "0.15.0"
},
{
"libraryName": "array-move",
"typingsPackageName": "array-move",
"sourceRepoURL": "https://github.com/sindresorhus/array-move",
"asOfVersion": "2.0.0"
},
{
"libraryName": "array-uniq",
"typingsPackageName": "array-uniq",
"sourceRepoURL": "https://github.com/sindresorhus/array-uniq",
"asOfVersion": "2.1.0"
},
{
"libraryName": "arrify",
"typingsPackageName": "arrify",
"sourceRepoURL": "https://github.com/sindresorhus/arrify",
"asOfVersion": "2.0.0"
},
{
"libraryName": "artyom.js",
"typingsPackageName": "artyom.js",
@@ -870,6 +906,12 @@
"sourceRepoURL": "https://handsontable.com/",
"asOfVersion": "0.35.0"
},
{
"libraryName": "hard-rejection",
"typingsPackageName": "hard-rejection",
"sourceRepoURL": "https://github.com/sindresorhus/hard-rejection",
"asOfVersion": "2.0.0"
},
{
"libraryName": "has-yarn",
"typingsPackageName": "has-yarn",
@@ -1008,6 +1050,18 @@
"sourceRepoURL": "http://ionicframework.com",
"asOfVersion": "3.19.0"
},
{
"libraryName": "is-absolute-url",
"typingsPackageName": "is-absolute-url",
"sourceRepoURL": "https://github.com/sindresorhus/is-absolute-url",
"asOfVersion": "3.0.0"
},
{
"libraryName": "is-fullwidth-code-point",
"typingsPackageName": "is-fullwidth-code-point",
"sourceRepoURL": "https://github.com/sindresorhus/is-fullwidth-code-point",
"asOfVersion": "3.0.0"
},
{
"libraryName": "is-lower-case",
"typingsPackageName": "is-lower-case",
@@ -1026,6 +1080,12 @@
"sourceRepoURL": "https://github.com/jonschlinkert/is-plain-object",
"asOfVersion": "2.0.4"
},
{
"libraryName": "is-relative-url",
"typingsPackageName": "is-relative-url",
"sourceRepoURL": "https://github.com/sindresorhus/is-relative-url",
"asOfVersion": "3.0.0"
},
{
"libraryName": "is-scoped",
"typingsPackageName": "is-scoped",
@@ -1110,6 +1170,12 @@
"sourceRepoURL": "https://github.com/jsplumb/jsPlumb",
"asOfVersion": "2.5.7"
},
{
"libraryName": "junk",
"typingsPackageName": "junk",
"sourceRepoURL": "https://github.com/sindresorhus/junk",
"asOfVersion": "3.0.0"
},
{
"libraryName": "keycloak-js",
"typingsPackageName": "keycloak-js",
@@ -1188,6 +1254,12 @@
"sourceRepoURL": "https://github.com/brunolm/LinqSharp",
"asOfVersion": "1.0.0"
},
{
"libraryName": "load-json-file",
"typingsPackageName": "load-json-file",
"sourceRepoURL": "https://github.com/sindresorhus/load-json-file",
"asOfVersion": "5.1.0"
},
{
"libraryName": "localforage",
"typingsPackageName": "localforage",
@@ -1224,6 +1296,12 @@
"sourceRepoURL": "https://github.com/nomiddlename/log4js-node",
"asOfVersion": "2.3.5"
},
{
"libraryName": "loud-rejection",
"typingsPackageName": "loud-rejection",
"sourceRepoURL": "https://github.com/sindresorhus/loud-rejection",
"asOfVersion": "2.0.0"
},
{
"libraryName": "lower-case",
"typingsPackageName": "lower-case",
@@ -1434,6 +1512,18 @@
"sourceRepoURL": "https://github.com/sindresorhus/ora",
"asOfVersion": "3.2.0"
},
{
"libraryName": "os-name",
"typingsPackageName": "os-name",
"sourceRepoURL": "https://github.com/sindresorhus/os-name",
"asOfVersion": "3.1.0"
},
{
"libraryName": "p-all",
"typingsPackageName": "p-all",
"sourceRepoURL": "https://github.com/sindresorhus/p-all",
"asOfVersion": "2.0.0"
},
{
"libraryName": "p-any",
"typingsPackageName": "p-any",
@@ -1458,6 +1548,18 @@
"sourceRepoURL": "https://github.com/sindresorhus/p-debounce",
"asOfVersion": "2.0.0"
},
{
"libraryName": "p-defer",
"typingsPackageName": "p-defer",
"sourceRepoURL": "https://github.com/sindresorhus/p-defer",
"asOfVersion": "2.0.0"
},
{
"libraryName": "p-do-whilst",
"typingsPackageName": "p-do-whilst",
"sourceRepoURL": "https://github.com/sindresorhus/p-do-whilst",
"asOfVersion": "1.0.0"
},
{
"libraryName": "p-each-series",
"typingsPackageName": "p-each-series",
@@ -1476,6 +1578,24 @@
"sourceRepoURL": "https://github.com/kevva/p-every",
"asOfVersion": "2.0.0"
},
{
"libraryName": "p-forever",
"typingsPackageName": "p-forever",
"sourceRepoURL": "https://github.com/sindresorhus/p-forever",
"asOfVersion": "2.0.0"
},
{
"libraryName": "p-is-promise",
"typingsPackageName": "p-is-promise",
"sourceRepoURL": "https://github.com/sindresorhus/p-is-promise",
"asOfVersion": "2.1.0"
},
{
"libraryName": "p-lazy",
"typingsPackageName": "p-lazy",
"sourceRepoURL": "https://github.com/sindresorhus/p-lazy",
"asOfVersion": "2.0.0"
},
{
"libraryName": "p-limit",
"typingsPackageName": "p-limit",
@@ -1512,6 +1632,12 @@
"sourceRepoURL": "https://github.com/sindresorhus/p-memoize",
"asOfVersion": "3.0.0"
},
{
"libraryName": "p-min-delay",
"typingsPackageName": "p-min-delay",
"sourceRepoURL": "https://github.com/sindresorhus/p-min-delay",
"asOfVersion": "3.0.0"
},
{
"libraryName": "p-one",
"typingsPackageName": "p-one",
@@ -1548,6 +1674,12 @@
"sourceRepoURL": "https://github.com/sindresorhus/p-reduce",
"asOfVersion": "2.0.0"
},
{
"libraryName": "p-reflect",
"typingsPackageName": "p-reflect",
"sourceRepoURL": "https://github.com/sindresorhus/p-reflect",
"asOfVersion": "2.0.0"
},
{
"libraryName": "p-retry",
"typingsPackageName": "p-retry",
@@ -1560,6 +1692,12 @@
"sourceRepoURL": "https://github.com/sindresorhus/p-series",
"asOfVersion": "2.0.0"
},
{
"libraryName": "p-settle",
"typingsPackageName": "p-settle",
"sourceRepoURL": "https://github.com/sindresorhus/p-settle",
"asOfVersion": "3.0.0"
},
{
"libraryName": "p-some",
"typingsPackageName": "p-some",
@@ -1578,12 +1716,48 @@
"sourceRepoURL": "https://github.com/sindresorhus/p-throttle",
"asOfVersion": "2.1.0"
},
{
"libraryName": "p-time",
"typingsPackageName": "p-time",
"sourceRepoURL": "https://github.com/sindresorhus/p-time",
"asOfVersion": "2.0.0"
},
{
"libraryName": "p-timeout",
"typingsPackageName": "p-timeout",
"sourceRepoURL": "https://github.com/sindresorhus/p-timeout",
"asOfVersion": "3.0.0"
},
{
"libraryName": "p-times",
"typingsPackageName": "p-times",
"sourceRepoURL": "https://github.com/sindresorhus/p-times",
"asOfVersion": "2.0.0"
},
{
"libraryName": "p-try",
"typingsPackageName": "p-try",
"sourceRepoURL": "https://github.com/sindresorhus/p-try",
"asOfVersion": "2.1.0"
},
{
"libraryName": "p-wait-for",
"typingsPackageName": "p-wait-for",
"sourceRepoURL": "https://github.com/sindresorhus/p-wait-for",
"asOfVersion": "3.0.0"
},
{
"libraryName": "p-waterfall",
"typingsPackageName": "p-waterfall",
"sourceRepoURL": "https://github.com/sindresorhus/p-waterfall",
"asOfVersion": "2.0.0"
},
{
"libraryName": "p-whilst",
"typingsPackageName": "p-whilst",
"sourceRepoURL": "https://github.com/sindresorhus/p-whilst",
"asOfVersion": "2.0.0"
},
{
"libraryName": "package-json",
"typingsPackageName": "package-json",
@@ -2034,6 +2208,12 @@
"sourceRepoURL": "https://github.com/sindresorhus/screenfull.js",
"asOfVersion": "4.1.0"
},
{
"libraryName": "sdbm",
"typingsPackageName": "sdbm",
"sourceRepoURL": "https://github.com/sindresorhus/sdbm",
"asOfVersion": "1.1.0"
},
{
"libraryName": "sendgrid",
"typingsPackageName": "sendgrid",
@@ -2046,6 +2226,12 @@
"sourceRepoURL": "https://github.com/blakeembrey/sentence-case",
"asOfVersion": "1.1.3"
},
{
"libraryName": "serialize-error",
"typingsPackageName": "serialize-error",
"sourceRepoURL": "https://github.com/sindresorhus/serialize-error",
"asOfVersion": "4.0.0"
},
{
"libraryName": "sharp-timer",
"typingsPackageName": "sharp-timer",
@@ -2076,12 +2262,36 @@
"sourceRepoURL": "https://github.com/sindresorhus/df",
"asOfVersion": "3.0.0"
},
{
"libraryName": "djb2a",
"typingsPackageName": "sindresorhus__djb2a",
"sourceRepoURL": "https://github.com/sindresorhus/djb2a",
"asOfVersion": "1.1.0"
},
{
"libraryName": "@sindresorhus/fnv1a",
"typingsPackageName": "sindresorhus__fnv1a",
"sourceRepoURL": "https://github.com/sindresorhus/fnv1a",
"asOfVersion": "1.1.0"
},
{
"libraryName": "@sindresorhus/slugify",
"typingsPackageName": "sindresorhus__slugify",
"sourceRepoURL": "https://github.com/sindresorhus/slugify",
"asOfVersion": "0.9.1"
},
{
"libraryName": "@sindresorhus/string-hash",
"typingsPackageName": "sindresorhus__string-hash",
"sourceRepoURL": "https://github.com/sindresorhus/string-hash",
"asOfVersion": "1.1.0"
},
{
"libraryName": "@sindresorhus/to-milliseconds",
"typingsPackageName": "sindresorhus__to-milliseconds",
"sourceRepoURL": "https://github.com/sindresorhus/to-milliseconds",
"asOfVersion": "1.1.0"
},
{
"libraryName": "sip.js",
"typingsPackageName": "sip.js",
@@ -2148,12 +2358,36 @@
"sourceRepoURL": "https://github.com/storybooks/storybook",
"asOfVersion": "5.0.0"
},
{
"libraryName": "string-length",
"typingsPackageName": "string-length",
"sourceRepoURL": "https://github.com/sindresorhus/string-length",
"asOfVersion": "3.0.0"
},
{
"libraryName": "string-width",
"typingsPackageName": "string-width",
"sourceRepoURL": "https://github.com/sindresorhus/string-width",
"asOfVersion": "4.0.0"
},
{
"libraryName": "strip-ansi",
"typingsPackageName": "strip-ansi",
"sourceRepoURL": "https://github.com/chalk/strip-ansi",
"asOfVersion": "5.2.0"
},
{
"libraryName": "striptags",
"typingsPackageName": "striptags",
"sourceRepoURL": "https://github.com/ericnorris/striptags",
"asOfVersion": "3.1.1"
},
{
"libraryName": "subsume",
"typingsPackageName": "subsume",
"sourceRepoURL": "https://github.com/sindresorhus/subsume",
"asOfVersion": "2.1.0"
},
{
"libraryName": "Sugar",
"typingsPackageName": "sugar",
@@ -2460,6 +2694,12 @@
"sourceRepoURL": "none",
"asOfVersion": "2.1.0"
},
{
"libraryName": "yn",
"typingsPackageName": "yn",
"sourceRepoURL": "https://github.com/sindresorhus/yn",
"asOfVersion": "3.1.0"
},
{
"libraryName": "zapier-platform-core",
"typingsPackageName": "zapier-platform-core",

View File

@@ -1,5 +0,0 @@
import allKeys = require('all-keys');
allKeys(Symbol.prototype); // $ExpectType Set<string>
allKeys(Symbol.prototype, { includeObjectPrototype: false }); // $ExpectType Set<string>
allKeys(Symbol.prototype, { includeSymbols: false }); // $ExpectType Set<string>

View File

@@ -1,29 +0,0 @@
// Type definitions for all-keys 2.0
// Project: https://github.com/sindresorhus/all-keys#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export = allKeys;
/**
* Get all property keys of an object including non-enumerable and inherited ones.
* Like [Reflect.ownKeys()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Reflect/ownKeys)
* but traverses up the prototype-chain.
*/
declare function allKeys(obj: object, options?: allKeys.Options): Set<string>;
declare namespace allKeys {
interface Options {
/**
* Include `Object.prototype` properties like `isPrototypeOf`.
* @default true
*/
includeObjectPrototype?: boolean;
/**
* Include [Symbol](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Symbol) keys.
* @default true
*/
includeSymbols?: boolean;
}
}

View File

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

View File

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

View File

@@ -1,4 +0,0 @@
import allPropertyNames = require('all-property-names');
// $ExpectType Set<string>
allPropertyNames(Symbol.prototype);

View File

@@ -1,9 +0,0 @@
// Type definitions for all-property-names 1.0
// Project: https://github.com/sindresorhus/all-property-names#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.2
export = allPropertyNames;
declare function allPropertyNames(input: object): Set<string>;

View File

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

View File

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

View File

@@ -1,3 +0,0 @@
import * as ansi from "ansi-escapes";
console.log(ansi.cursorUp(2) + ansi.cursorLeft === "\u001B[2A\u001B[1000D");

View File

@@ -1,57 +0,0 @@
// Type definitions for ansi-escapes 3.0
// Project: https://github.com/sindresorhus/ansi-escapes
// Definitions by: Rong Shen <https://github.com/jacobbubu>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
declare namespace Ansi {
interface ImageOptions {
width?: number;
height?: number;
preserveAspectRatio?: boolean;
}
interface Term {
setCwd(cwd: string): string;
}
interface AnsiEscapes {
cursorTo(x: number, y?: number): string;
cursorMove(x: number, y?: number): string;
cursorUp(count?: number): string;
cursorDown(count?: number): string;
cursorForward(count?: number): string;
cursorBackward(count?: number): string;
cursorLeft: string;
cursorSavePosition: string;
cursorRestorePosition: string;
cursorGetPosition: string;
cursorNextLine: string;
cursorPrevLine: string;
cursorHide: string;
cursorShow: string;
eraseLines(count: number): string;
eraseEndLine: string;
eraseStartLine: string;
eraseLine: string;
eraseDown: string;
eraseUp: string;
eraseScreen: string;
scrollUp: string;
scrollDown: string;
clearScreen: string;
beep: string;
link(text: string, url: string): string;
image(buf: Buffer, opts?: ImageOptions): string;
iTerm: Term;
}
}
declare const ansiEscapes: Ansi.AnsiEscapes;
export = ansiEscapes;

View File

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

View File

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

View File

@@ -1,8 +0,0 @@
import arrayMove = require('array-move');
const input = ['a', 'b', 'c'];
const input2 = [1, 2, 3];
arrayMove(input, 1, 2); // $ExpectType string[]
arrayMove(input2, 1, 2); // $ExpectType number[]
arrayMove.mut(input, 1, 2); // $ExpectType void

View File

@@ -1,27 +0,0 @@
// Type definitions for array-move 1.0
// Project: https://github.com/sindresorhus/array-move
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = arrayMove;
/**
* Move an array item to a different position.
*
* @param from Index of item to move. If negative, it will begin that many elements from the end.
* @param to Index of where to move the item. If negative, it will begin that many elements from the end.
* @returns A new array with the item moved to the new position.
*/
declare function arrayMove<T extends any[]>(input: T, from: number, to: number): T;
declare namespace arrayMove {
/**
* Moves the item to the new position in the input array.
*
* Useful for huge arrays where absolute performance is needed.
*
* @param from Index of item to move. If negative, it will begin that many elements from the end.
* @param to Index of where to move the item. If negative, it will begin that many elements from the end.
*/
function mut(input: any[], from: number, to: number): void;
}

View File

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

View File

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

View File

@@ -1,5 +0,0 @@
import arrayUniq = require("array-uniq");
arrayUniq([1, 1, 2, 3, 3]);
arrayUniq(["foo", "foo", "bar", "foo"]);

View File

@@ -1,8 +0,0 @@
// Type definitions for array-uniq 1.0
// Project: https://github.com/sindresorhus/array-uniq
// Definitions by: Daniel Rosenwasser <https://github.com/DanielRosenwasser>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare function arrayUniq<T>(arr: T[]): T[];
export = arrayUniq;

View File

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

View File

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

View File

@@ -1,86 +0,0 @@
import * as arrify from 'arrify';
/***************** arrify<T> *****************/
arrify(null);
arrify<number>(null);
arrify(undefined);
arrify<number>(undefined);
arrify(1);
arrify([2, 3]);
function test(val?: string | string[]) {
arrify(val);
}
/***************** arrify<T> *****************/
/***************** arrify<T1, T2> *****************/
arrify<number, string>(undefined); // returns []
arrify<number, string>(null); // returns []
{
const value: number | string[] = 2018;
arrify<number, string>(value); // returns [2018]
}
{
const value: number[] | string | string[] = ['a', 'b'];
arrify<number, string>(value); // returns ['a', 'b']
}
/***************** arrify<T1, T2> *****************/
/***************** arrify<T1, T2, T3> *****************/
arrify<boolean, number, string>(undefined);
arrify<boolean, number, string>(null);
{
const value: boolean | number[] | string[] = true;
// returns [true]
arrify<boolean, number, string>(value);
}
{
const value: boolean[] | number | string[] = ['a', 'b'];
// returns ['a', 'b']
arrify<boolean, number, string>(value);
}
/***************** arrify<T1, T2, T3> *****************/
/***************** arrify<T1, T2, T3, T4> *****************/
arrify<boolean, Date, number, string>(undefined);
arrify<boolean, Date, number, string>(null);
{
const value: boolean | Date | number[] | string[] = new Date(2018);
// returns [ new Date(2018) ]
arrify<boolean, Date, number, string>(value);
}
{
const value: boolean[] | Date[] | number | string = [true, false];
// returns [true, false]
arrify<boolean, Date, number, string>(value);
}
/***************** arrify<T1, T2, T3, T4> *****************/
/***************** arrify<T1, T2, T3, T4, T5> *****************/
arrify<boolean, Date, number, RegExp, string>(undefined);
arrify<boolean, Date, number, RegExp, string>(null);
{
const value: boolean | Date | number[] | RegExp | string[] = /test/;
// returns [ /test/ ]
arrify<boolean, Date, number, RegExp, string>(value);
}
{
const value: boolean[] | Date[] | number | RegExp[] | string = [/test1/, /test2/];
// returns [/test1/, /test2/]
arrify<boolean, Date, number, RegExp, string>(value);
}
/***************** arrify<T1, T2, T3, T4, T5> *****************/

View File

@@ -1,91 +0,0 @@
// Type definitions for arrify 1.0
// Project: https://github.com/sindresorhus/arrify
// Definitions by: AnJun Wang <https://github.com/wanganjun>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* @example
* arrify(undefined) // returns []
* @example
* arrify(null) // returns []
* @example
* arrify(1) // returns [1]
* @example
* arrify([2, 3]) // returns [2, 3]
*/
declare function arrify<T>(val: undefined | null | T | T[]): T[];
/**
* @example
* // returns []
* arrify<number, string>(undefined);
* @example
* // returns []
* arrify<number, string>(null);
* @example
* let value: number | string[] = 2018;
* // returns [2018]
* arrify<number, string>(value);
* @example
* let value: number[] | string | string[] = ['a', 'b'];
* // returns ['a', 'b']
* arrify<number, string>(value);
*/
declare function arrify<T1, T2>(val: undefined | null | T1 | T2 | T1[] | T2[]): T1[] | T2[];
/**
* @example
* // returns []
* arrify<boolean, number, string>(undefined);
* @example
* // returns []
* arrify<boolean, number, string>(null);
* @example
* let value: boolean | number[] | string[] = true;
* // returns [true]
* arrify<boolean, number, string>(value);
* @example
* let value: boolean[] | number | string[] = ['a', 'b'];
* // returns ['a', 'b']
* arrify<boolean, number, string>(value);
*/
declare function arrify<T1, T2, T3>(val: undefined | null | T1 | T2 | T3 | T1[] | T2[] | T3[]): T1[] | T2[] | T3[];
/**
* @example
* // returns []
* arrify<boolean, Date, number, string>(undefined);
* @example
* // returns []
* arrify<boolean, Date, number, string>(null);
* @example
* let value: boolean | Date | number[] | string[] = new Date(2018);
* // returns [ new Date(2018) ]
* arrify<boolean, Date, number, string>(value);
* @example
* let value: boolean[] | Date[] | number | string = [true, false];
* // returns [true, false]
* arrify<boolean, Date, number, string>(value);
*/
declare function arrify<T1, T2, T3, T4>(val: undefined | null | T1 | T2 | T3 | T4 | T1[] | T2[] | T3[] | T4[]): T1[] | T2[] | T3[] | T4[];
/**
* @example
* // returns []
* arrify<boolean, Date, number, RegExp, string>(undefined);
* @example
* // returns []
* arrify<boolean, Date, number, RegExp, string>(null);
* @example
* let value: boolean | Date | number[] | RegExp | string[] = /test/;
* // returns [ /test/ ]
* arrify<boolean, Date, number, RegExp, string>(value);
* @example
* let value: boolean[] | Date[] | number | RegExp[] | string = [/test1/, /test2/];
* // returns [/test1/, /test2/]
* arrify<boolean, Date, number, RegExp, string>(value);
*/
declare function arrify<T1, T2, T3, T4, T5>(val: undefined | null | T1 | T2 | T3 | T4 | T5 | T1[] | T2[] | T3[] | T4[] | T5[]): T1[] | T2[] | T3[] | T4[] | T5[];
declare namespace arrify {}
export = arrify;

View File

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

View File

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

View File

@@ -1,7 +0,0 @@
import hardRejection = require('hard-rejection');
import 'hard-rejection/register';
hardRejection();
hardRejection(stack => {
stack; // $ExpectType string | undefined
});

View File

@@ -1,8 +0,0 @@
// Type definitions for hard-rejection 1.0
// Project: https://github.com/sindresorhus/hard-rejection#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = hardRejection;
declare function hardRejection(log?: (stack?: string) => void): void;

View File

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

View File

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

View File

@@ -1,7 +0,0 @@
// Type definitions for is-absolute-url 2.1
// Project: https://github.com/sindresorhus/is-absolute-url#readme
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = is_absolute_url;
declare function is_absolute_url(url: string): boolean;

View File

@@ -1,10 +0,0 @@
import isAbsoluteUrl = require('is-absolute-url');
isAbsoluteUrl('http://sindresorhus.com/foo/bar');
// => true
isAbsoluteUrl('//sindresorhus.com');
// => false
isAbsoluteUrl('foo/bar');
// => false

View File

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

View File

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

View File

@@ -1,8 +0,0 @@
// Type definitions for is-fullwidth-code-point 2.0
// Project: https://github.com/sindresorhus/is-fullwidth-code-point#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = isFullwidthCodePoint;
declare function isFullwidthCodePoint(input: number): boolean;

View File

@@ -1,4 +0,0 @@
import isFullwidthCodePoint = require('is-fullwidth-code-point');
const codePoint = '谢'.codePointAt(0) as number;
isFullwidthCodePoint(codePoint); // $ExpectType boolean

View File

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

View File

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

View File

@@ -1,7 +0,0 @@
// Type definitions for is-relative-url 2.0
// Project: https://github.com/sindresorhus/is-relative-url
// Definitions by: Mohamed Hegazy <https://github.com/mhegazy>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = is_relative_url;
declare function is_relative_url(url: string): boolean;

View File

@@ -1,10 +0,0 @@
import isRelativeUrl = require('is-relative-url');
isRelativeUrl('foo/bar');
// => true
isRelativeUrl('http://sindresorhus.com/foo/bar');
// => false
isRelativeUrl('//sindresorhus.com');
// => true

View File

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

View File

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

17
types/junk/index.d.ts vendored
View File

@@ -1,17 +0,0 @@
// Type definitions for junk 2.1
// Project: https://github.com/sindresorhus/junk#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/**
* Returns `true` if `filename` matches a junk file.
*/
export function is(filename: string): boolean;
/**
* Returns `true` if `filename` doesn't match a junk file.
*/
export function not(filename: string): boolean;
/**
* Regex used for matching.
*/
export const regex: RegExp;

View File

@@ -1,12 +0,0 @@
/// <reference types="node" />
import fs = require('fs');
import * as junk from 'junk';
junk.is('foo'); // $ExpectType boolean
junk.not('foo'); // $ExpectType boolean
junk.regex; // $ExpectType RegExp
fs.readdir('some/path', (err, files) => {
files.filter(junk.not);
});

View File

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

View File

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

View File

@@ -1,20 +0,0 @@
// Type definitions for load-json-file 2.0
// Project: https://github.com/sindresorhus/load-json-file
// Definitions by: Sam Verschueren <https://github.com/SamVerschueren>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
interface LoadJsonFile {
/**
* Returns a promise for the parsed JSON.
*/
(filepath: string): Promise<any>;
/**
* Returns the parsed JSON.
*/
sync(filepath: string): any;
}
declare const loadJsonFile: LoadJsonFile;
export = loadJsonFile;

View File

@@ -1,14 +0,0 @@
import * as loadJsonFile from 'load-json-file';
function assert(actual: string, expected: string): void {
if (actual !== expected) {
throw new Error(`${JSON.stringify(actual)} !== ${JSON.stringify(expected)}`);
}
}
loadJsonFile('../package.json').then(pkg => {
assert(pkg.name, 'definitely-typed');
});
const pkg = loadJsonFile.sync('../package.json');
assert(pkg.name, 'definitely-typed');

View File

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

View File

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

View File

@@ -1,8 +0,0 @@
// Type definitions for loud-rejection 1.6
// Project: https://github.com/sindresorhus/loud-rejection#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = loudRejection;
declare function loudRejection(log?: (stack: string) => void): void;

View File

@@ -1,7 +0,0 @@
import loudRejection = require('loud-rejection');
import 'loud-rejection/register';
loudRejection();
loudRejection(stack => {
stack; // $ExpectType string
});

View File

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

View File

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

View File

@@ -1,11 +0,0 @@
// Type definitions for os-name 2.0
// Project: https://github.com/sindresorhus/os-name#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
export = osName;
declare function osName(): string;
declare function osName(platform: NodeJS.Platform, release: string): string;

View File

@@ -1,8 +0,0 @@
import * as os from 'os';
import osName = require('os-name');
osName();
osName(os.platform(), os.release());
osName('darwin', '14.0.0');
osName('linux', '3.13.0-24-generic');
osName('win32', '6.3.9600');

View File

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

View File

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

View File

@@ -1,43 +0,0 @@
// Type definitions for p-all 1.0
// Project: https://github.com/sindresorhus/p-all#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = pAll;
declare function pAll<T1, T2, T3, T4, T5, T6, T7, T8, T9, T10>(
tasks: [PromiseFactory<T1>, PromiseFactory<T2>, PromiseFactory<T3>, PromiseFactory<T4>, PromiseFactory<T5>, PromiseFactory<T6>, PromiseFactory<T7>,
PromiseFactory<T8>, PromiseFactory<T9>, PromiseFactory<T10>],
options?: pAll.Options): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9, T10]>;
declare function pAll<T1, T2, T3, T4, T5, T6, T7, T8, T9>(
tasks: [PromiseFactory<T1>, PromiseFactory<T2>, PromiseFactory<T3>, PromiseFactory<T4>, PromiseFactory<T5>, PromiseFactory<T6>, PromiseFactory<T7>,
PromiseFactory<T8>, PromiseFactory<T9>],
options?: pAll.Options): Promise<[T1, T2, T3, T4, T5, T6, T7, T8, T9]>;
declare function pAll<T1, T2, T3, T4, T5, T6, T7, T8>(
tasks: [PromiseFactory<T1>, PromiseFactory<T2>, PromiseFactory<T3>, PromiseFactory<T4>, PromiseFactory<T5>, PromiseFactory<T6>, PromiseFactory<T7>,
PromiseFactory<T8>],
options?: pAll.Options): Promise<[T1, T2, T3, T4, T5, T6, T7, T8]>;
declare function pAll<T1, T2, T3, T4, T5, T6, T7>(
tasks: [PromiseFactory<T1>, PromiseFactory<T2>, PromiseFactory<T3>, PromiseFactory<T4>, PromiseFactory<T5>, PromiseFactory<T6>, PromiseFactory<T7>],
options?: pAll.Options): Promise<[T1, T2, T3, T4, T5, T6, T7]>;
declare function pAll<T1, T2, T3, T4, T5, T6>(
tasks: [PromiseFactory<T1>, PromiseFactory<T2>, PromiseFactory<T3>, PromiseFactory<T4>, PromiseFactory<T5>, PromiseFactory<T6>],
options?: pAll.Options): Promise<[T1, T2, T3, T4, T5, T6]>;
declare function pAll<T1, T2, T3, T4, T5>(
tasks: [PromiseFactory<T1>, PromiseFactory<T2>, PromiseFactory<T3>, PromiseFactory<T4>, PromiseFactory<T5>],
options?: pAll.Options): Promise<[T1, T2, T3, T4, T5]>;
declare function pAll<T1, T2, T3, T4>(
tasks: [PromiseFactory<T1>, PromiseFactory<T2>, PromiseFactory<T3>, PromiseFactory<T4>],
options?: pAll.Options): Promise<[T1, T2, T3, T4]>;
declare function pAll<T1, T2, T3>(tasks: [PromiseFactory<T1>, PromiseFactory<T2>, PromiseFactory<T3>], options?: pAll.Options): Promise<[T1, T2, T3]>;
declare function pAll<T1, T2>(tasks: [PromiseFactory<T1>, PromiseFactory<T2>], options?: pAll.Options): Promise<[T1, T2]>;
declare function pAll<T1>(tasks: [PromiseFactory<T1>], options?: pAll.Options): Promise<[T1]>;
declare function pAll<TAll>(tasks: Iterable<PromiseFactory<TAll>> | Array<PromiseFactory<TAll>>, options?: pAll.Options): Promise<TAll[]>;
type PromiseFactory<T> = () => Promise<T> | PromiseLike<T>;
declare namespace pAll {
interface Options {
concurrency?: number;
}
}

View File

@@ -1,14 +0,0 @@
import pAll = require('p-all');
const actions: [() => Promise<string>, () => Promise<string>, () => Promise<void>, () => Promise<number>] = [
() => Promise.resolve('sindresorhus.com'),
() => Promise.resolve('ava.li'),
() => Promise.resolve(),
() => Promise.resolve(1)
];
pAll(actions, {concurrency: 2}).then(result => {
const str: string = result[0];
const str2: string = result[1];
const num: number = result[3];
});

View File

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

View File

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

View File

@@ -1,17 +0,0 @@
// Type definitions for p-defer 1.0
// Project: https://github.com/sindresorhus/p-defer
// Definitions by: Sam Verschueren <https://github.com/SamVerschueren>
// BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = pDefer;
declare function pDefer<T>(): pDefer.DeferredPromise<T>;
declare namespace pDefer {
interface DeferredPromise<T> {
resolve(value?: T | PromiseLike<T>): void;
reject(reason: any): void;
promise: Promise<T>;
}
}

View File

@@ -1,13 +0,0 @@
import pDefer = require('p-defer');
function delay(deferred: pDefer.DeferredPromise<string>, ms: number) {
setTimeout(deferred.resolve, ms, '🦄');
return deferred.promise;
}
const s: Promise<string> = delay(pDefer<string>(), 100);
// $ExpectType void
pDefer().resolve();
// $ExpectType void
pDefer().reject('oh no');

View File

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

View File

@@ -1,6 +0,0 @@
{
"extends": "dtslint/dt.json",
"rules": {
"no-unnecessary-generics": false
}
}

View File

@@ -1,8 +0,0 @@
// Type definitions for p-do-whilst 0.1
// Project: https://github.com/sindresorhus/p-do-whilst#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = pDoWhilst;
declare function pDoWhilst(action: () => any, condition: () => boolean): Promise<void>;

View File

@@ -1,5 +0,0 @@
import pDoWhilst = require('p-do-whilst');
let count = 0;
pDoWhilst(() => count++, () => count < 5).then(() => {});

View File

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

View File

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

View File

@@ -1,19 +0,0 @@
// Type definitions for p-forever 1.0
// Project: https://github.com/sindresorhus/p-forever#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.7
export = pForever;
declare function pForever<T>(
fn: (previousValue?: T) => T | PromiseLike<T> | typeof pForever.end
): Promise<void>;
declare function pForever<T>(
fn: (previousValue: T) => T | PromiseLike<T> | typeof pForever.end,
initialValue: T
): Promise<void>;
declare namespace pForever {
const end: unique symbol;
}

View File

@@ -1,33 +0,0 @@
import pForever = require('p-forever');
// $ExpectType Promise<void>
pForever(i => {
// $ExpectType number
i;
i++;
return i <= 100 ? i : pForever.end;
}, 0);
// $ExpectType Promise<void>
pForever(i => {
// $ExpectType number
i;
i++;
return i <= 100 ? Promise.resolve(i) : pForever.end;
}, 0);
let i = 0;
// $ExpectType Promise<void>
pForever<number>(prevI => {
// $ExpectType number | undefined
prevI;
i++;
return i <= 100 ? i : pForever.end;
});
// $ExpectType Promise<void>
pForever<number>(prevI => {
// $ExpectType number | undefined
prevI;
i++;
return i <= 100 ? Promise.resolve(i) : pForever.end;
});

View File

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

View File

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

View File

@@ -1,8 +0,0 @@
// Type definitions for p-is-promise 2.0
// Project: https://github.com/sindresorhus/p-is-promise#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = pIsPromise;
declare function pIsPromise(promise: any): promise is Promise<any>;

View File

@@ -1,6 +0,0 @@
import pIsPromise = require('p-is-promise');
// $ExpectType boolean
pIsPromise(Promise.resolve('🦄'));
// $ExpectType boolean
pIsPromise('🦄');

View File

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

View File

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

View File

@@ -1,10 +0,0 @@
// Type definitions for p-lazy 1.0
// Project: https://github.com/sindresorhus/p-lazy#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = PLazy;
declare class PLazy<T> extends Promise<T> {
static from<T>(fn: () => T | PromiseLike<T>): PLazy<T>;
}

View File

@@ -1,23 +0,0 @@
import PLazy = require('p-lazy');
const lazyPromise = new PLazy<string>((resolve, reject) => {
if (!true) {
resolve('foo');
} else {
reject(new Error());
}
});
let str: string;
lazyPromise.then(result => str = result);
Promise.resolve()
.then(() => lazyPromise)
.then(value => str = value);
let num: number;
PLazy.from(() => Promise.resolve(1))
.then(value => num = value);
PLazy.from(() => 1)
.then(value => num = value);

View File

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

View File

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

View File

@@ -1,18 +0,0 @@
// Type definitions for p-min-delay 2.0
// Project: https://github.com/sindresorhus/p-min-delay#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = pMinDelay;
declare function pMinDelay<T>(
input: PromiseLike<T>,
minimumDelay: number,
options?: pMinDelay.Options
): Promise<T>;
declare namespace pMinDelay {
interface Options {
delayRejection?: boolean;
}
}

View File

@@ -1,6 +0,0 @@
import pMinDelay = require('p-min-delay');
// $ExpectType Promise<number>
pMinDelay(Promise.resolve(1), 1000);
// $ExpectType Promise<string>
pMinDelay(Promise.resolve("1"), 1000, { delayRejection: false });

View File

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

View File

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

View File

@@ -1,24 +0,0 @@
// Type definitions for p-reflect 1.0
// Project: https://github.com/sindresorhus/p-reflect#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = pReflect;
declare function pReflect<T>(promise: PromiseLike<T>): Promise<pReflect.PromiseResult<T>>;
declare namespace pReflect {
type PromiseResult<T> = PromiseFulfilledResult<T> | PromiseRejectedResult;
interface PromiseFulfilledResult<T> {
isFulfilled: true;
isRejected: false;
value: T;
}
interface PromiseRejectedResult {
isFulfilled: false;
isRejected: true;
reason: any;
}
}

View File

@@ -1,15 +0,0 @@
import pReflect = require('p-reflect');
pReflect(Promise.resolve('foo')).then(result => {
if (result.isFulfilled) {
const fulfilled: true = result.isFulfilled;
const rejected: false = result.isRejected;
const str: string = result.value;
result.reason; // $ExpectError
} else {
const fulfilled: false = result.isFulfilled;
const rejected: true = result.isRejected;
const err: any = result.reason;
result.value; // $ExpectError
}
});

View File

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

View File

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

View File

@@ -1,28 +0,0 @@
// Type definitions for p-settle 2.0
// Project: https://github.com/sindresorhus/p-settle#readme
// Definitions by: Nate Silva <https://github.com/natesilva>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace pSettle {
interface SettledResult<T> {
isFulfilled: boolean;
isRejected: boolean;
/** If the promise was fulfilled, the resolved value */
value?: T;
/** If the promise was rejected, the reason */
reason?: any;
}
}
/**
* Returns a Promise that is fulfilled when all promises in `input` are settled.
*
* The fulfilled value is an array of objects with the following properties:
*
* * `isFulfilled`
* * `isRejected`
* * `value` or `reason` (Depending on whether the promise fulfilled or rejected)
*/
declare function pSettle<T>(input: Iterable<PromiseLike<T>>): Promise<Array<pSettle.SettledResult<T>>>;
export = pSettle;

View File

@@ -1,13 +0,0 @@
import pSettle = require('p-settle');
async function f() {
const promises: Array<Promise<string>> = [];
for (let index = 0; index < 10; ++index) {
if (index % 3 === 0) {
promises.push(Promise.reject(new Error('i reject you')));
} else {
promises.push(Promise.resolve('🦄'));
}
}
const results = await pSettle(promises);
}

View File

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

View File

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

View File

@@ -1,19 +0,0 @@
// Type definitions for p-time 1.0
// Project: https://github.com/sindresorhus/p-time#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
export = pTime;
declare function pTime<TArgs extends any[], TRes>(
fn: (...args: TArgs) => PromiseLike<TRes>
): (...args: TArgs) => pTime.PromiseWithTime<TRes>;
declare namespace pTime {
const log: typeof pTime;
interface PromiseWithTime<T> extends Promise<T> {
time?: number;
}
}

View File

@@ -1,24 +0,0 @@
import pTime = require('p-time');
const wrappedFn = pTime(async (input: number) => {
return input;
});
// $ExpectType (input: number) => PromiseWithTime<number>
wrappedFn;
// $ExpectType number | undefined
wrappedFn(1).time;
// $ExpectError
pTime((input: number) => {
return input;
});
// $ExpectError
wrappedFn('foo');
// $ExpectType (input: number) => PromiseWithTime<number>
pTime.log(async (input: number) => {
return input;
});

View File

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

View File

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

View File

@@ -1,18 +0,0 @@
// Type definitions for p-times 1.0
// Project: https://github.com/sindresorhus/p-times#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
export = pTimes;
declare function pTimes<T>(
count: number,
mapper: (index: number) => T | PromiseLike<T>,
options?: pTimes.Options
): Promise<T[]>;
declare namespace pTimes {
interface Options {
concurrency?: number;
}
}

View File

@@ -1,6 +0,0 @@
import pTimes = require('p-times');
// $ExpectType Promise<string[]>
pTimes(5, i => `🦄-${i + 1}`);
// $ExpectType Promise<string[]>
pTimes(5, i => `🦄-${i + 1}`, { concurrency: 1 });

View File

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

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