mirror of
https://github.com/ArthurDanjou/trpc-nuxt.git
synced 2026-01-14 20:19:33 +01:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4f7fbbe108 | ||
|
|
c32fdf7893 | ||
|
|
10bc1d3a4d | ||
|
|
7bd62822d3 | ||
|
|
967271089f |
@@ -3,7 +3,7 @@
|
||||
"description": "End-to-end typesafe APIs in Nuxt applications.",
|
||||
"type": "module",
|
||||
"packageManager": "pnpm@7.32.4",
|
||||
"version": "0.10.0",
|
||||
"version": "0.10.2",
|
||||
"license": "MIT",
|
||||
"sideEffects": false,
|
||||
"exports": {
|
||||
@@ -36,8 +36,7 @@
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@trpc/client": "^10.26.0",
|
||||
"@trpc/server": "^10.26.0",
|
||||
"nuxt": "^3.4.0"
|
||||
"@trpc/server": "^10.26.0"
|
||||
},
|
||||
"dependencies": {
|
||||
"h3": "^1.6.5",
|
||||
|
||||
@@ -1,4 +1,13 @@
|
||||
<script setup lang="ts">
|
||||
import { TRPCClientError, TRPCClientErrorLike } from '@trpc/client'
|
||||
import type { inferRouterOutputs } from '@trpc/server'
|
||||
import type { AppRouter } from '@/server/trpc/routers'
|
||||
|
||||
type RouterOutput = inferRouterOutputs<AppRouter>
|
||||
type GetTodosOutput = RouterOutput['todo']['getTodos']
|
||||
|
||||
type ErrorOutput = TRPCClientError<AppRouter>
|
||||
|
||||
const { $client } = useNuxtApp()
|
||||
|
||||
const addTodo = async () => {
|
||||
|
||||
15
pnpm-lock.yaml
generated
15
pnpm-lock.yaml
generated
@@ -1524,9 +1524,9 @@ packages:
|
||||
defu: 6.1.2
|
||||
hookable: 5.5.3
|
||||
pathe: 1.1.0
|
||||
pkg-types: 1.0.2
|
||||
pkg-types: 1.0.3
|
||||
postcss-import-resolver: 2.0.0
|
||||
std-env: 3.3.2
|
||||
std-env: 3.3.3
|
||||
ufo: 1.1.2
|
||||
unimport: 3.0.6(rollup@3.20.2)
|
||||
untyped: 1.3.2
|
||||
@@ -1557,7 +1557,7 @@ packages:
|
||||
ofetch: 1.0.1
|
||||
parse-git-config: 3.0.0
|
||||
rc9: 2.1.0
|
||||
std-env: 3.3.2
|
||||
std-env: 3.3.3
|
||||
transitivePeerDependencies:
|
||||
- rollup
|
||||
- supports-color
|
||||
@@ -1592,12 +1592,12 @@ packages:
|
||||
ohash: 1.1.2
|
||||
pathe: 1.1.0
|
||||
perfect-debounce: 0.1.3
|
||||
pkg-types: 1.0.2
|
||||
pkg-types: 1.0.3
|
||||
postcss: 8.4.23
|
||||
postcss-import: 15.1.0(postcss@8.4.23)
|
||||
postcss-url: 10.1.3(postcss@8.4.23)
|
||||
rollup-plugin-visualizer: 5.9.0(rollup@3.20.2)
|
||||
std-env: 3.3.2
|
||||
std-env: 3.3.3
|
||||
strip-literal: 1.0.1
|
||||
ufo: 1.1.2
|
||||
unplugin: 1.3.1
|
||||
@@ -7730,6 +7730,7 @@ packages:
|
||||
|
||||
/std-env@3.3.2:
|
||||
resolution: {integrity: sha512-uUZI65yrV2Qva5gqE0+A7uVAvO40iPo6jGhs7s8keRfHCmtg+uB2X6EiLGCI9IgL1J17xGhvoOqSz79lzICPTA==}
|
||||
dev: true
|
||||
|
||||
/std-env@3.3.3:
|
||||
resolution: {integrity: sha512-Rz6yejtVyWnVjC1RFvNmYL10kgjC49EOghxWn0RFqlCHGFpQx+Xe7yW3I4ceK1SGrWIGMjD5Kbue8W/udkbMJg==}
|
||||
@@ -8270,7 +8271,7 @@ packages:
|
||||
magic-string: 0.30.0
|
||||
mlly: 1.2.0
|
||||
pathe: 1.1.0
|
||||
pkg-types: 1.0.2
|
||||
pkg-types: 1.0.3
|
||||
scule: 1.0.0
|
||||
strip-literal: 1.0.1
|
||||
unplugin: 1.3.1
|
||||
@@ -8287,7 +8288,7 @@ packages:
|
||||
magic-string: 0.30.0
|
||||
mlly: 1.2.0
|
||||
pathe: 1.1.0
|
||||
pkg-types: 1.0.2
|
||||
pkg-types: 1.0.3
|
||||
scule: 1.0.0
|
||||
strip-literal: 1.0.1
|
||||
unplugin: 1.3.1
|
||||
|
||||
@@ -50,12 +50,14 @@ type DecorateProcedure<
|
||||
> = TProcedure extends AnyQueryProcedure
|
||||
? {
|
||||
useQuery: <
|
||||
TData = inferTransformedProcedureOutput<TProcedure>,
|
||||
PickKeys extends KeysOf<TData> = KeysOf<TData>,
|
||||
ResT = inferTransformedProcedureOutput<TProcedure>,
|
||||
DataE = TRPCClientErrorLike<TProcedure>,
|
||||
DataT = ResT,
|
||||
PickKeys extends KeysOf<DataT> = KeysOf<DataT>,
|
||||
>(
|
||||
input: inferProcedureInput<TProcedure>,
|
||||
opts?: AsyncDataOptions<TData, TData, PickKeys> & { trpc?: TRPCRequestOptions },
|
||||
) => AsyncData<PickFrom<TData, PickKeys>, TRPCClientErrorLike<TProcedure>>,
|
||||
opts?: AsyncDataOptions<ResT, DataT, PickKeys> & { trpc?: TRPCRequestOptions },
|
||||
) => AsyncData<PickFrom<DataT, PickKeys>, DataE>,
|
||||
query: Resolver<TProcedure>
|
||||
} : TProcedure extends AnyMutationProcedure ? {
|
||||
mutate: Resolver<TProcedure>
|
||||
|
||||
Reference in New Issue
Block a user