Skip to content

Commit

Permalink
[Tutorial]: Fix Typescript code blocks inconsistency (#6801)
Browse files Browse the repository at this point in the history
* fix doc inconsistency
* update type for createContact exemple
  • Loading branch information
simoncrypta authored and web-flow committed Nov 6, 2022
1 parent 52f3ca4 commit 2a6fbd7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions docs/docs/tutorial/chapter3/saving-data.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,9 +298,10 @@ export const deleteContact = ({ id }) => {
<TabItem value="ts" label="TypeScript">

```js title="api/src/services/contacts/contacts.ts"
import { db } from 'src/lib/db'
import type { QueryResolvers, MutationResolvers } from 'types/graphql'

import { db } from 'src/lib/db'

export const contacts: QueryResolvers['contacts'] = () => {
return db.contact.findMany()
}
Expand Down Expand Up @@ -1280,14 +1281,14 @@ export const createContact = ({ input }) => {
<TabItem value="ts" label="TypeScript">

```ts title="api/src/services/contacts/contacts.ts"
import type { Prisma } from '@prisma/client'
import type { QueryResolvers, MutationResolvers } from 'types/graphql'

// highlight-next-line
import { validate } from '@redwoodjs/api'

// ...

export const createContact = ({ input }: CreateContactArgs) => {
export const createContact = ({ input }: MutationResolvers['createContact']) => {
// highlight-next-line
validate(input.email, 'email', { email: true })
return db.contact.create({ data: input })
Expand Down

0 comments on commit 2a6fbd7

Please # to comment.