Uh oh!
There was an error while loading. Please reload this page.
fix(data-objectstack): type the exportDownload test fetch mock so its type-check passes - #2726
Merged
Merged
Conversation
… type-check passes `vi.fn(async () => csvResponse())` infers a zero-arg signature, so `fetchImpl.mock.calls[0]` was an empty tuple — `const [url, init] = ...` then tripped TS2493 (no element at index 0/1), TS2345 (`url` is `undefined`), and TS18048 (`init` possibly undefined). Type the mock like `fetch` (`(_url: string, _init: RequestInit)`) so the recorded call args are `[url, init]`. Pre-existing failure surfaced by a cold `tsc` cache; no runtime change. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The latest updates on your projects. Learn more about Vercel for GitHub. |
Contributor
✅ Console Performance Budget
📦 Bundle Size Report
Size Limits
|
Uh oh!
There was an error while loading. Please reload this page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for freeto join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
packages/data-objectstack/src/exportDownload.test.tsfailstsc --noEmiton a cold cache:Root cause:
vi.fn(async () => csvResponse())infers a zero-arg signature, sofetchImpl.mock.calls[0]is typed as an empty tuple[].const [url, init] = fetchImpl.mock.calls[0]then can't index it (url/initareundefined).Fix: type the mock like
fetch—vi.fn(async (_url: string, _init: RequestInit) => csvResponse())— so the recorded call args are[url, init]. Test-only; no runtime change.Spotted while working on #2723 (unrelated); splitting it out as its own PR.
Verification
turbo run type-check --filter=@object-ui/data-objectstack→ 3/3 successful (deps built, then tsc), clean.vitest run packages/data-objectstack/src/exportDownload.test.ts→ 4/4 passed.🤖 Generated with Claude Code