Merge pull request #33384 from BendingBender/remove-p-pipe

[p-pipe] Remove definitions
This commit is contained in:
Jesse Trinity
2019-02-27 10:05:23 -08:00
committed by GitHub
5 changed files with 6 additions and 167 deletions

View File

@@ -1146,6 +1146,12 @@
"sourceRepoURL": "https://github.com/sindresorhus/p-map",
"asOfVersion": "2.0.0"
},
{
"libraryName": "p-pipe",
"typingsPackageName": "p-pipe",
"sourceRepoURL": "https://github.com/sindresorhus/p-pipe",
"asOfVersion": "2.0.0"
},
{
"libraryName": "p-throttle",
"typingsPackageName": "p-throttle",

View File

@@ -1,86 +0,0 @@
// Type definitions for p-pipe 1.2
// Project: https://github.com/sindresorhus/p-pipe#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 3.0
export = pPipe;
// tslint:disable:no-unnecessary-generics
declare function pPipe<T1, R>(...args: Tasks1<T1, R>): PromiseTask<T1, R>;
declare function pPipe<T1, T2, R>(...args: Tasks2<T1, T2, R>): PromiseTask<T1, R>;
declare function pPipe<T1, T2, T3, R>(...args: Tasks3<T1, T2, T3, R>): PromiseTask<T1, R>;
declare function pPipe<T1, T2, T3, T4, R>(...args: Tasks4<T1, T2, T3, T4, R>): PromiseTask<T1, R>;
declare function pPipe<T1, T2, T3, T4, T5, R>(
...args: Tasks5<T1, T2, T3, T4, T5, R>
): PromiseTask<T1, R>;
declare function pPipe<T1, T2, T3, T4, T5, T6, R>(
...args: Tasks6<T1, T2, T3, T4, T5, T6, R>
): PromiseTask<T1, R>;
declare function pPipe<T1, T2, T3, T4, T5, T6, T7, R>(
...args: Tasks7<T1, T2, T3, T4, T5, T6, T7, R>
): PromiseTask<T1, R>;
declare function pPipe<T1, T2, T3, T4, T5, T6, T7, T8, R>(
...args: Tasks8<T1, T2, T3, T4, T5, T6, T7, T8, R>
): PromiseTask<T1, R>;
declare function pPipe(...args: Array<Task<any, any>>): PromiseTask<any, any>;
declare function pPipe<T1, R>(tasks: Tasks1<T1, R>): PromiseTask<T1, R>;
declare function pPipe<T1, T2, R>(tasks: Tasks2<T1, T2, R>): PromiseTask<T1, R>;
declare function pPipe<T1, T2, T3, R>(tasks: Tasks3<T1, T2, T3, R>): PromiseTask<T1, R>;
declare function pPipe<T1, T2, T3, T4, R>(tasks: Tasks4<T1, T2, T3, T4, R>): PromiseTask<T1, R>;
declare function pPipe<T1, T2, T3, T4, T5, R>(
tasks: Tasks5<T1, T2, T3, T4, T5, R>
): PromiseTask<T1, R>;
declare function pPipe<T1, T2, T3, T4, T5, T6, R>(
tasks: Tasks6<T1, T2, T3, T4, T5, T6, R>
): PromiseTask<T1, R>;
declare function pPipe<T1, T2, T3, T4, T5, T6, T7, R>(
tasks: Tasks7<T1, T2, T3, T4, T5, T6, T7, R>
): PromiseTask<T1, R>;
declare function pPipe<T1, T2, T3, T4, T5, T6, T7, T8, R>(
tasks: Tasks8<T1, T2, T3, T4, T5, T6, T7, T8, R>
): PromiseTask<T1, R>;
declare function pPipe(tasks: Array<Task<any, any>>): PromiseTask<any, any>;
type Tasks1<T1, R> = [PromiseTask<T1, R>];
type Tasks2<T1, T2, R> = [Task<T1, T2>, Task<T2, R>];
type Tasks3<T1, T2, T3, R> = [Task<T1, T2>, Task<T2, T3>, Task<T3, R>];
type Tasks4<T1, T2, T3, T4, R> = [Task<T1, T2>, Task<T2, T3>, Task<T3, T4>, Task<T4, R>];
type Tasks5<T1, T2, T3, T4, T5, R> = [
Task<T1, T2>,
Task<T2, T3>,
Task<T3, T4>,
Task<T4, T5>,
Task<T5, R>
];
type Tasks6<T1, T2, T3, T4, T5, T6, R> = [
Task<T1, T2>,
Task<T2, T3>,
Task<T3, T4>,
Task<T4, T5>,
Task<T5, T6>,
Task<T6, R>
];
type Tasks7<T1, T2, T3, T4, T5, T6, T7, R> = [
Task<T1, T2>,
Task<T2, T3>,
Task<T3, T4>,
Task<T4, T5>,
Task<T5, T6>,
Task<T6, T7>,
Task<T7, R>
];
type Tasks8<T1, T2, T3, T4, T5, T6, T7, T8, R> = [
Task<T1, T2>,
Task<T2, T3>,
Task<T3, T4>,
Task<T4, T5>,
Task<T5, T6>,
Task<T6, T7>,
Task<T7, T8>,
Task<T8, R>
];
type Task<T, R> = (input: T) => PromiseLike<R> | R;
type PromiseTask<T, R> = (input: T) => Promise<R>;

View File

@@ -1,57 +0,0 @@
import pPipe = require('p-pipe');
const addUnicorn = (str: string) => Promise.resolve(`${str} Unicorn`);
const addRainbow = (str: string) => Promise.resolve(`${str} Rainbow`);
const pipeline = pPipe(addUnicorn, addRainbow);
pipeline('❤️'); // $ExpectType Promise<string>
const strToInt = (s: string) => Promise.resolve(1);
const intToBool = (i: number) => Promise.resolve(true);
const boolToObj = (b: boolean) => Promise.resolve({});
const objToNull = (o: object) => Promise.resolve(null);
const nullToVoid = (n: null) => Promise.resolve(undefined);
const voidToStr = (u: undefined) => Promise.resolve('');
pPipe(strToInt); // $ExpectType PromiseTask<string, number>
pPipe(strToInt, intToBool); // $ExpectType PromiseTask<string, boolean>
pPipe(strToInt, intToBool, boolToObj); // $ExpectType PromiseTask<string, {}>
pPipe(strToInt, intToBool, boolToObj, objToNull); // $ExpectType PromiseTask<string, null>
pPipe(strToInt, intToBool, boolToObj, objToNull, nullToVoid); // $ExpectType PromiseTask<string, undefined>
pPipe(strToInt, intToBool, boolToObj, objToNull, nullToVoid, voidToStr); // $ExpectType PromiseTask<string, string>
pPipe(strToInt, intToBool, boolToObj, objToNull, nullToVoid, voidToStr, strToInt); // $ExpectType PromiseTask<string, number>
pPipe(strToInt, intToBool, boolToObj, objToNull, nullToVoid, voidToStr, strToInt, intToBool); // $ExpectType PromiseTask<string, boolean>
// $ExpectType PromiseTask<any, any>
pPipe(
strToInt,
intToBool,
boolToObj,
objToNull,
nullToVoid,
voidToStr,
strToInt,
intToBool,
boolToObj
);
pPipe([strToInt]); // $ExpectType PromiseTask<string, number>
pPipe([strToInt, intToBool]); // $ExpectType PromiseTask<string, boolean>
pPipe([strToInt, intToBool, boolToObj]); // $ExpectType PromiseTask<string, {}>
pPipe([strToInt, intToBool, boolToObj, objToNull]); // $ExpectType PromiseTask<string, null>
pPipe([strToInt, intToBool, boolToObj, objToNull, nullToVoid]); // $ExpectType PromiseTask<string, undefined>
pPipe([strToInt, intToBool, boolToObj, objToNull, nullToVoid, voidToStr]); // $ExpectType PromiseTask<string, string>
pPipe([strToInt, intToBool, boolToObj, objToNull, nullToVoid, voidToStr, strToInt]); // $ExpectType PromiseTask<string, number>
pPipe([strToInt, intToBool, boolToObj, objToNull, nullToVoid, voidToStr, strToInt, intToBool]); // $ExpectType PromiseTask<string, boolean>
// $ExpectType PromiseTask<any, any>
pPipe([
strToInt,
intToBool,
boolToObj,
objToNull,
nullToVoid,
voidToStr,
strToInt,
intToBool,
boolToObj,
]);

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

View File

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