Merge pull request #28380 from Hoishin/remove-delay

[delay] Remove @types/delay
This commit is contained in:
Armando Aguirre
2018-08-31 16:57:23 -07:00
committed by GitHub
5 changed files with 6 additions and 108 deletions

View File

@@ -390,6 +390,12 @@
"sourceRepoURL": "https://github.com/MikeMcl/decimal.js",
"asOfVersion": "7.4.0"
},
{
"libraryName": "delay",
"typingsPackageName": "delay",
"sourceRepoURL": "https://github.com/sindresorhus/delay",
"asOfVersion": "3.1.0"
},
{
"libraryName": "DevExtreme",
"typingsPackageName": "devextreme",

View File

@@ -1,47 +0,0 @@
import delay = require('delay');
delay(200)
.then(() => {
});
let str: string;
let num: number;
Promise.resolve(delay(100))
.then(() => {
});
Promise.resolve("foo")
.then(delay<string>(100))
.then(result => {
str = result;
});
Promise.resolve('foo')
.then(delay(100, 10))
.then(result => {
num = result;
});
Promise.resolve('foo')
.then(delay.reject(100))
.then(x => 10)
.catch(err => {
});
Promise.resolve('foo')
.then(delay.reject(100, 'bar'))
.then(x => 10)
.catch(err => {
});
(async () => {
const delaying = delay(1000);
delaying.cancel();
try {
await delaying;
} catch (err) {
// `err` is an instance of `delay.CancelError`
}
})();
throw new delay.CancelError('bar');

View File

@@ -1,30 +0,0 @@
// Type definitions for delay 2.0
// Project: https://github.com/sindresorhus/delay#readme
// Definitions by: BendingBender <https://github.com/BendingBender>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
// TypeScript Version: 2.3
export = delay;
declare function delay<T>(ms: number): delay.PDelayedPassThroughThunk<T>;
declare function delay<T>(ms: number, value: T): delay.PDelayedThunk<T>;
declare namespace delay {
function reject(ms: number, rejectionValue?: any): PDelayedThunk<never>;
class CancelError extends Error {
readonly name: 'CancelError';
constructor(message?: string);
}
type PDelayedThunk<T> = ((value: any) => DelayedPromiseLike<T>) & DelayedPromiseLike<T>;
type PDelayedPassThroughThunk<TValue> = ((value: TValue) => DelayedPromiseLike<TValue>) & DelayedPromiseLike<void>;
interface DelayedPromiseLike<T> {
then<TResult1 = T, TResult2 = never>(onfulfilled?: ((value: T) => TResult1 | PromiseLike<TResult1>) | null,
onrejected?: ((reason: any) => TResult2 | PromiseLike<TResult2>) | null): Promise<TResult1 | TResult2>;
catch<TResult = never>(onrejected?: ((reason: any) => TResult | PromiseLike<TResult>) | null): Promise<T | TResult>;
cancel(): 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",
"delay-tests.ts"
]
}

View File

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