Skip to content

Instantly share code, notes, and snippets.

@artalar
Created August 8, 2022 20:38
Show Gist options
  • Save artalar/2359942d9a19d51608fbaa6fc36e0094 to your computer and use it in GitHub Desktop.
Save artalar/2359942d9a19d51608fbaa6fc36e0094 to your computer and use it in GitHub Desktop.
type MyPromise<T> = Promise<Awaited<T>>
async function call<T extends () => any>(fn: T): MyPromise<ReturnType<T>> {
return fn()
}
const res = call(() =>
call(() =>
call(() =>
call(() =>
call(() =>
call(() =>
call(() =>
call(() =>
call(() =>
call(() =>
call(() =>
call(() =>
call(() =>
call(() =>
call(() =>
call(() =>
call(() =>
call(() =>
call(() =>
call(() => call(() => call(() => {}))),
),
),
),
),
),
),
),
),
),
),
),
),
),
),
),
),
),
),
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment