⚝
One Hat Cyber Team
⚝
Your IP:
216.73.216.1
Server IP:
185.238.29.86
Server:
Linux server2 6.8.12-6-pve #1 SMP PREEMPT_DYNAMIC PMX 6.8.12-6 (2024-12-19T19:05Z) x86_64
Server Software:
nginx/1.18.0
PHP Version:
8.1.31
Buat File
|
Buat Folder
Eksekusi
Dir :
~
/
var
/
www
/
invoice
/
node_modules
/
type-fest
/
source
/
Edit File: asyncify.d.ts
import {PromiseValue} from './promise-value'; import {SetReturnType} from './set-return-type'; /** Create an async version of the given function type, by boxing the return type in `Promise` while keeping the same parameter types. Use-case: You have two functions, one synchronous and one asynchronous that do the same thing. Instead of having to duplicate the type definition, you can use `Asyncify` to reuse the synchronous type. @example ``` import {Asyncify} from 'type-fest'; // Synchronous function. function getFooSync(someArg: SomeType): Foo { // … } type AsyncifiedFooGetter = Asyncify<typeof getFooSync>; //=> type AsyncifiedFooGetter = (someArg: SomeType) => Promise<Foo>; // Same as `getFooSync` but asynchronous. const getFooAsync: AsyncifiedFooGetter = (someArg) => { // TypeScript now knows that `someArg` is `SomeType` automatically. // It also knows that this function must return `Promise<Foo>`. // If you have `@typescript-eslint/promise-function-async` linter rule enabled, it will even report that "Functions that return promises must be async.". // … } ``` */ export type Asyncify<Fn extends (...args: any[]) => any> = SetReturnType<Fn, Promise<PromiseValue<ReturnType<Fn>>>>;
Simpan