update types

This commit is contained in:
Robert Soriano
2022-05-17 14:25:03 -07:00
parent bb5dc377d5
commit 9fac4ac4d9
25 changed files with 479 additions and 363 deletions

7
playground/.gitignore vendored Normal file
View File

@@ -0,0 +1,7 @@
node_modules
*.log*
.nuxt
.nitro
.cache
.output
.env

42
playground/README.md Normal file
View File

@@ -0,0 +1,42 @@
# Nuxt 3 Minimal Starter
Look at the [nuxt 3 documentation](https://v3.nuxtjs.org) to learn more.
## Setup
Make sure to install the dependencies:
```bash
# yarn
yarn install
# npm
npm install
# pnpm
pnpm install --shamefully-hoist
```
## Development Server
Start the development server on http://localhost:3000
```bash
npm run dev
```
## Production
Build the application for production:
```bash
npm run build
```
Locally preview production build:
```bash
npm run preview
```
Checkout the [deployment documentation](https://v3.nuxtjs.org/docs/deployment) for more information.

14
playground/app.vue Normal file
View File

@@ -0,0 +1,14 @@
<script setup lang="ts">
const { data, error } = await useTrpcQuery('getUser', {
name: 'john',
})
watchEffect(() => {
console.log(data.value)
console.log('err', error.value)
})
</script>
<template>
<div>hello</div>
</template>

10
playground/nuxt.config.ts Normal file
View File

@@ -0,0 +1,10 @@
import { defineNuxtConfig } from 'nuxt'
import Module from '..'
// https://v3.nuxtjs.org/api/configuration/nuxt.config
export default defineNuxtConfig({
modules: [Module],
typescript: {
strict: true,
},
})

4
playground/package.json Normal file
View File

@@ -0,0 +1,4 @@
{
"name": "playground",
"private": true
}

View File

@@ -0,0 +1,16 @@
import * as trpc from '@trpc/server'
import { z } from 'zod'
export const router = trpc
.router()
.query('getUser', {
input: z.object({ name: z.string().min(5) }),
async resolve(req) {
return { id: 1, name: req.input.name }
},
})
.query('hello', {
resolve: () => 'world',
})
export type Router = typeof router