You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Trpc sucks, it takes way too much setup and SvelteKit is very clever and types a lot of things already. Parameters are typed already for pages and I don’t think it is too far fetched an idea to think api routes could be typed too, my self - I do not have the knowledge to create such a thing. I might just be dreaming and this is impossible but typed APIs out of the box would be an awesome headline feature of sveltekit
Describe the proposed solution
The syntax to use it would look something like this;
<!-- /src/routes/+page.svelte -->
<script>
import { api } from'@sveltejs/kit/api';asyncfunctionget() {constres=awaitapi("/api/test").get();// res = { status: 500, body: { message: "failed" } } | { status: 200, body: { message: "success" } }// if there was a body or headers they can go in the method function// const res = await api("/api/test").get({ body: {} }); }
</script>
<buttononclick={get}>Get</button>
Alternatives considered
No response
Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered:
Describe the problem
Trpc sucks, it takes way too much setup and SvelteKit is very clever and types a lot of things already. Parameters are typed already for pages and I don’t think it is too far fetched an idea to think api routes could be typed too, my self - I do not have the knowledge to create such a thing. I might just be dreaming and this is impossible but typed APIs out of the box would be an awesome headline feature of sveltekit
Describe the proposed solution
The syntax to use it would look something like this;
Alternatives considered
No response
Importance
would make my life easier
Additional Information
No response
The text was updated successfully, but these errors were encountered: