Releases: webrpc/gen-typescript
Releases · webrpc/gen-typescript
v0.21.0
What's Changed
- Add query keys by @AlexanderKolberg in #41
- Stricter TypeScript by @AlexanderKolberg in #40
Features
Query Keys for React Query / SWR
The generated client now includes a queryKey property with type-safe query key generators for each endpoint. This makes it easy to use with popular data-fetching
libraries like tanstack query and Vercel's SWR
import { useQuery } from '@tanstack/react-query'
import { Example } from './client.gen'
const client = new Example('http://localhost:3000', fetch)
function UserProfile({ userId }) {
const { data } = useQuery({
queryKey: client.queryKey.getUser({ userId }),
queryFn: ({ signal }) => client.getUser({ userId }, undefined, signal)
})
return <div>{data?.user.name}</div>
}The query keys follow the pattern [ServiceName, methodName, request?]
Full Changelog: v0.20.2...v0.21.0
v0.19.0
What's Changed
- Improve TypeScript around error messages by @VojtechVitek in #34
Full Changelog: v0.18.0...v0.19.0
v0.18.0
What's Changed
- Use WebrpcClientAbortedError on abort signal by @VojtechVitek in #32
- Add default HTTP status to error definitions by @VojtechVitek in #33
- Add default HTTP status to schema errors too by @VojtechVitek in #35
Full Changelog: v0.17.0...v0.18.0
v0.17.0
What's Changed
- Add JSDoc comments, support @deprecated annotation by @VojtechVitek in #28
Full Changelog: v0.16.3...v0.17.0
v0.16.3
What's Changed
- Fix typescript possible undefined values by @ScreamingHawk in #27
New Contributors
- @ScreamingHawk made their first contribution in #27
Full Changelog: v0.16.2...v0.16.3
v0.16.2
What's Changed
- Export
webrpcErrorByCodeon generated files by @yigiterdev in #25 - Allow single quotes in schema error description by @VojtechVitek in #26
New Contributors
- @yigiterdev made their first contribution in #25
Full Changelog: v0.16.0...v0.16.2
v0.16.1
What's Changed
- SSE: Add abort and closed methods by @AlexanderKolberg in #21
- Export
webrpcErrorByCodeon generated files by @yigiterdev in #25
New Contributors
- @yigiterdev made their first contribution in #25
Full Changelog: v0.15.1...v0.16.1
v0.16.0
What's Changed
- SSE: Add abort and closed methods by @AlexanderKolberg in #21
Full Changelog: v0.15.1...v0.16.0
v0.15.1
What's Changed
- Add missing types to request header by @AlexanderKolberg in #24
Full Changelog: v0.15.0...v0.15.1
v0.15.0
What's Changed
- render webrpcHeader on client and server if enabled by @LukasJenicek in #23
Full Changelog: v0.14.1...v0.15.0