[PR #864] [MERGED] fix(shims): narrow runWith* return type when callback is async #905

Closed
opened 2026-05-06 13:10:45 +02:00 by BreizhHardware · 0 comments

📋 Pull Request Information

Original PR: https://github.com/cloudflare/vinext/pull/864
Author: @fengmk2
Created: 4/21/2026
Status: Merged
Merged: 4/21/2026
Merged by: @james-elicx

Base: mainHead: fix/lint-await-thenable-overloads


📝 Commits (2)

  • 6c206a8 fix(shims): narrow runWith* return type when callback is async
  • 673468c fix(shims): narrow remaining runWith* return types when callback is async

📊 Changes

9 files changed (+43 additions, -0 deletions)

View changed files

📝 packages/vinext/src/shims/cache-runtime.ts (+2 -0)
📝 packages/vinext/src/shims/cache.ts (+2 -0)
📝 packages/vinext/src/shims/head-state.ts (+2 -0)
📝 packages/vinext/src/shims/headers.ts (+5 -0)
📝 packages/vinext/src/shims/i18n-state.ts (+2 -0)
📝 packages/vinext/src/shims/navigation-state.ts (+4 -0)
📝 packages/vinext/src/shims/request-context.ts (+8 -0)
📝 packages/vinext/src/shims/router-state.ts (+2 -0)
📝 packages/vinext/src/shims/unified-request-context.ts (+16 -0)

📄 Description

Add Promise<T> overloads to runWithRequestContext, runWithHeadersContext, and runWithNavigationContext so async callbacks don't widen the return type to T | Promise<T>. This clears 4 typescript-eslint(await-thenable) warnings where Promise.all received the wider union.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/cloudflare/vinext/pull/864 **Author:** [@fengmk2](https://github.com/fengmk2) **Created:** 4/21/2026 **Status:** ✅ Merged **Merged:** 4/21/2026 **Merged by:** [@james-elicx](https://github.com/james-elicx) **Base:** `main` ← **Head:** `fix/lint-await-thenable-overloads` --- ### 📝 Commits (2) - [`6c206a8`](https://github.com/cloudflare/vinext/commit/6c206a8d97bed3b8da082ada6bde6a9e1a67a371) fix(shims): narrow runWith* return type when callback is async - [`673468c`](https://github.com/cloudflare/vinext/commit/673468c9a0c7e559505b956266dccd4acd98d29e) fix(shims): narrow remaining runWith* return types when callback is async ### 📊 Changes **9 files changed** (+43 additions, -0 deletions) <details> <summary>View changed files</summary> 📝 `packages/vinext/src/shims/cache-runtime.ts` (+2 -0) 📝 `packages/vinext/src/shims/cache.ts` (+2 -0) 📝 `packages/vinext/src/shims/head-state.ts` (+2 -0) 📝 `packages/vinext/src/shims/headers.ts` (+5 -0) 📝 `packages/vinext/src/shims/i18n-state.ts` (+2 -0) 📝 `packages/vinext/src/shims/navigation-state.ts` (+4 -0) 📝 `packages/vinext/src/shims/request-context.ts` (+8 -0) 📝 `packages/vinext/src/shims/router-state.ts` (+2 -0) 📝 `packages/vinext/src/shims/unified-request-context.ts` (+16 -0) </details> ### 📄 Description Add `Promise<T>` overloads to runWithRequestContext, runWithHeadersContext, and runWithNavigationContext so async callbacks don't widen the return type to `T | Promise<T>`. This clears 4 typescript-eslint(await-thenable) warnings where `Promise.all` received the wider union. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
BreizhHardware 2026-05-06 13:10:45 +02:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/vinext#905
No description provided.