Skip to content

Commit 8e4011c

Browse files
authored
Merge pull request #266 from hamsurang/ts.mdx
feat: ts.mdx ๋ฒˆ์—ญ ๋ฐ sync ์ž‘์—…
2 parents 88387b6 + d6ebae8 commit 8e4011c

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

โ€Žsrc/content/ts.mdxโ€Ž

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ sidebar: tsLinks
88

99
## \</> Resolver {#Resolver}
1010

11-
```typescript copy sandbox="https://codesandbox.io/s/react-hook-form-resolver-forked-mjsx7"
11+
```tsx copy sandbox="https://codesandbox.io/s/react-hook-form-resolver-forked-mjsx7"
1212
import React from "react"
1313
import { useForm, Resolver } from "react-hook-form"
1414

@@ -56,7 +56,7 @@ export default function App() {
5656

5757
## \</> SubmitHandler {#SubmitHandler}
5858

59-
```typescript copy sandbox="https://codesandbox.io/s/react-hook-form-handlesubmit-ts-v7-z9z0g"
59+
```tsx copy sandbox="https://codesandbox.io/s/react-hook-form-handlesubmit-ts-v7-z9z0g"
6060
import React from "react"
6161
import { useForm, SubmitHandler } from "react-hook-form"
6262

@@ -86,7 +86,7 @@ export default function App() {
8686

8787
## \</> SubmitErrorHandler {#SubmitErrorHandler}
8888

89-
```typescript copy
89+
```tsx copy
9090
import React from "react"
9191
import { useForm, SubmitHandler, SubmitErrorHandler } from "react-hook-form"
9292

@@ -104,8 +104,8 @@ export default function App() {
104104

105105
return (
106106
<form onSubmit={handleSubmit(onSubmit, onError)}>
107-
<input {...(register("firstName"), { required: true })} />
108-
<input {...(register("lastName"), { minLength: 2 })} />
107+
<input {...register("firstName", { required: true })} />
108+
<input {...register("lastName", { minLength: 2 })} />
109109
<input type="email" {...register("email")} />
110110

111111
<input type="submit" />
@@ -118,7 +118,7 @@ export default function App() {
118118

119119
## \</> Control {#Control}
120120

121-
```typescript copy sandbox="https://codesandbox.io/s/control-2mg07"
121+
```tsx copy sandbox="https://codesandbox.io/s/control-2mg07"
122122
import { useForm, useWatch, Control } from "react-hook-form"
123123

124124
type FormValues = {
@@ -158,7 +158,7 @@ export default function App() {
158158

159159
<TabGroup buttonLabels={["Type", "Code Example"]}>
160160

161-
```typescript copy
161+
```tsx copy
162162
export type UseFormReturn<
163163
TFieldValues extends FieldValues = FieldValues,
164164
TContext = any,
@@ -182,7 +182,7 @@ export type UseFormReturn<
182182
}
183183
```
184184
185-
```typescript copy sandbox="https://codesandbox.io/s/react-hook-form-UseFormReturn-forked-yl40u"
185+
```tsx copy sandbox="https://codesandbox.io/s/react-hook-form-UseFormReturn-forked-yl40u"
186186
import type { FieldValues, UseFormReturn, SubmitHandler } from "react-hook-form"
187187
import React from "react"
188188
import { useForm } from "react-hook-form"
@@ -268,7 +268,7 @@ export default function App() {
268268

269269
## \</> UseFormProps {#UseFormProps}
270270

271-
```typescript copy
271+
```tsx copy
272272
export type UseFormProps<
273273
TFieldValues extends FieldValues = FieldValues,
274274
TContext extends object = object,
@@ -296,7 +296,7 @@ export type UseFormProps<
296296
297297
## \</> UseFieldArrayReturn {#UseFieldArrayReturn}
298298
299-
```typescript copy
299+
```tsx copy
300300
export type UseFieldArrayReturn<
301301
TFieldValues extends FieldValues = FieldValues,
302302
TFieldArrayName extends FieldArrayPath<TFieldValues> = FieldArrayPath<TFieldValues>,
@@ -346,7 +346,7 @@ export type UseFieldArrayProps<
346346
347347
## \</> UseControllerReturn {#UseControllerReturn}
348348
349-
```typescript copy
349+
```tsx copy
350350
export type UseControllerReturn<
351351
TFieldValues extends FieldValues = FieldValues,
352352
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
@@ -361,7 +361,7 @@ export type UseControllerReturn<
361361
362362
## \</> UseControllerProps {#UseControllerProps}
363363
364-
```typescript copy
364+
```tsx copy
365365
export type UseControllerProps<
366366
TFieldValues extends FieldValues = FieldValues,
367367
TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
@@ -382,7 +382,7 @@ export type UseControllerProps<
382382
383383
## \</> FieldError {#FieldError}
384384
385-
```typescript copy
385+
```tsx copy
386386
export type FieldError = {
387387
type: LiteralUnion<keyof RegisterOptions, string>
388388
root?: FieldError
@@ -396,7 +396,7 @@ export type FieldError = {
396396
397397
## \</> FieldErrors {#FieldErrors}
398398
399-
```typescript copy
399+
```tsx copy
400400
export type FieldErrors<T extends FieldValues = FieldValues> = Partial<
401401
FieldValues extends IsAny<FieldValues>
402402
? any
@@ -410,7 +410,7 @@ export type FieldErrors<T extends FieldValues = FieldValues> = Partial<
410410
411411
## \</> Field {#Field}
412412
413-
```typescript copy
413+
```tsx copy
414414
export type Field = {
415415
_f: {
416416
ref: Ref
@@ -427,7 +427,7 @@ export type Field = {
427427
428428
์ด ํƒ€์ž…์€ ์ปค์Šคํ…€ ์ปดํฌ๋„ŒํŠธ์˜ `name` ์†์„ฑ์„ ์ •์˜ํ•  ๋•Œ ์œ ์šฉํ•˜๋ฉฐ, ํ•„๋“œ ๊ฒฝ๋กœ์— ๋Œ€ํ•ด ํƒ€์ž… ๊ฒ€์‚ฌ๋ฅผ ์ˆ˜ํ–‰ํ•ฉ๋‹ˆ๋‹ค.
429429
430-
```typescript copy
430+
```tsx copy
431431
export type FieldPath<TFieldValues extends FieldValues> = Path<TFieldValues>
432432
```
433433
@@ -437,7 +437,7 @@ export type FieldPath<TFieldValues extends FieldValues> = Path<TFieldValues>
437437
438438
์ด ํƒ€์ž…์€ ์ „๋‹ฌ๋œ ๊ฐ’๊ณผ ์ผ์น˜ํ•˜๋Š” ์‚ฌ์šฉ ๊ฐ€๋Šฅํ•œ ๋ชจ๋“  ๊ฒฝ๋กœ์˜ ์œ ๋‹ˆ์˜จ ํƒ€์ž…์„ ๋ฐ˜ํ™˜ํ•ฉ๋‹ˆ๋‹ค.
439439
440-
```typescript copy
440+
```tsx copy
441441
export type FieldPathByValue<TFieldValues extends FieldValues, TValue> = {
442442
[Key in FieldPath<TFieldValues>]: FieldPathValue<
443443
TFieldValues,
@@ -452,15 +452,15 @@ export type FieldPathByValue<TFieldValues extends FieldValues, TValue> = {
452452
453453
## \</> FieldValues {#FieldValues}
454454
455-
```typescript copy
455+
```tsx copy
456456
export type FieldValues = Record<string, any>
457457
```
458458
459459
---
460460
461461
## \</> FieldArrayWithId {#FieldArrayWithId}
462462
463-
```typescript copy
463+
```tsx copy
464464
export type FieldArrayWithId<
465465
TFieldValues extends FieldValues = FieldValues,
466466
TFieldArrayName extends FieldArrayPath<TFieldValues> = FieldArrayPath<TFieldValues>,
@@ -472,7 +472,7 @@ export type FieldArrayWithId<
472472
473473
## \</> Mode {#Mode}
474474
475-
```typescript copy
475+
```tsx copy
476476
export type ValidationMode = typeof VALIDATION_MODE
477477

478478
export type Mode = keyof ValidationMode
@@ -482,7 +482,7 @@ export type Mode = keyof ValidationMode
482482
483483
## \</> RegisterOptions {#RegisterOptions}
484484
485-
```typescript copy
485+
```tsx copy
486486
export type RegisterOptions<
487487
TFieldValues extends FieldValues = FieldValues,
488488
TFieldName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>
@@ -529,7 +529,7 @@ export type RegisterOptions<
529529
530530
## \</> FormStateProxy {#FormStateProxy}
531531
532-
```typescript copy
532+
```tsx copy
533533
export type FormStateProxy<TFieldValues extends FieldValues = FieldValues> = {
534534
isDirty: boolean
535535
isValidating: boolean
@@ -547,10 +547,10 @@ export type FormStateProxy<TFieldValues extends FieldValues = FieldValues> = {
547547
548548
<TabGroup buttonLabels={["Code Example", "Type"]}>
549549
550-
```typescript copy sandbox="https://codesandbox.io/s/react-hook-form-nestedvalue-lskdv"
550+
```tsx copy sandbox="https://codesandbox.io/s/react-hook-form-nestedvalue-lskdv"
551551
import React from "react"
552552
import { useForm, NestedValue } from "react-hook-form"
553-
import { Autocomplete, TextField, Select } from "@material-ui/core"
553+
import { TextField, Select } from "@material-ui/core"
554554
import { Autocomplete } from "@material-ui/lab"
555555

556556
type Option = {
@@ -605,7 +605,7 @@ export default function App() {
605605

606606
<Select
607607
value=""
608-
onChange={(e) => setValue("muiSelect", e.target.value as number[])}
608+
onChange={(e) => setValue("select", e.target.value as number[])}
609609
>
610610
<MenuItem value={10}>Ten</MenuItem>
611611
<MenuItem value={20}>Twenty</MenuItem>
@@ -617,7 +617,7 @@ export default function App() {
617617
}
618618
```
619619

620-
```typescript copy
620+
```tsx copy
621621
import { useForm, NestedValue } from "react-hook-form"
622622

623623
type FormValues = {

0 commit comments

Comments
ย (0)