Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Load fetch types are wrong #691

Closed
ebeloded opened this issue Mar 25, 2021 · 0 comments · Fixed by #799
Closed

Load fetch types are wrong #691

ebeloded opened this issue Mar 25, 2021 · 0 comments · Fixed by #799
Labels
bug Something isn't working help wanted PRs welcomed. The implementation details are unlikely to cause debate types / typescript

Comments

@ebeloded
Copy link

ebeloded commented Mar 25, 2021

This is a regression introduced in #670

LoadInput's fetch now returns Response imported from types.d.ts, which is not Fetch API response.

// types-internal.d.ts
import { ..., Response } from './types'; // <- problem
export type LoadInput = {
	page: Page;
	fetch: (info: RequestInfo, init?: RequestInit) => Promise<Response>; // <- wrong response
	session: any;
	context: Record<string, any>;
};
// types.d.ts
export type Response = {
	status?: number;
	headers?: Headers;
	body?: any;
};

image

PS. To catch type-related issues, maybe transition examples to TypeScript and use svelte-check to verify correctness?

@Rich-Harris Rich-Harris added bug Something isn't working help wanted PRs welcomed. The implementation details are unlikely to cause debate labels Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted PRs welcomed. The implementation details are unlikely to cause debate types / typescript
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants