File tree Expand file tree Collapse file tree 4 files changed +26
-24
lines changed Expand file tree Collapse file tree 4 files changed +26
-24
lines changed Original file line number Diff line number Diff line change 1- import {
2- data ,
3- type LoaderFunctionArgs ,
4- type HeadersFunction ,
5- type LinksFunction ,
6- type MetaFunction ,
7- } from 'react-router' ;
8- import {
9- Form ,
10- Link ,
11- Links ,
12- Meta ,
13- Outlet ,
14- Scripts ,
15- ScrollRestoration ,
16- useLoaderData ,
17- useMatches ,
18- useSubmit ,
19- } from 'react-router' ;
201import { withSentry } from '@sentry/remix'
212import { useRef } from 'react'
3+ import {
4+ data ,
5+ type LoaderFunctionArgs ,
6+ type HeadersFunction ,
7+ type LinksFunction ,
8+ type MetaFunction ,
9+ Form ,
10+ Link ,
11+ Links ,
12+ Meta ,
13+ Outlet ,
14+ Scripts ,
15+ ScrollRestoration ,
16+ useLoaderData ,
17+ useMatches ,
18+ useSubmit ,
19+ } from 'react-router'
2220import { HoneypotProvider } from 'remix-utils/honeypot/react'
2321import appleTouchIconAssetUrl from './assets/favicons/apple-touch-icon.png'
2422import faviconAssetUrl from './assets/favicons/favicon.svg'
Original file line number Diff line number Diff line change 55 data ,
66 type LoaderFunctionArgs ,
77 type ActionFunctionArgs ,
8- type SerializeFrom ,
98 type HeadersFunction ,
109 useFetcher ,
1110 useLoaderData ,
@@ -159,6 +158,8 @@ export default function Connections() {
159158 )
160159}
161160
161+ type SerializeFrom < T > = ReturnType < typeof useLoaderData < T > >
162+
162163function Connection ( {
163164 connection,
164165 canDelete,
Original file line number Diff line number Diff line change 99} from '@conform-to/react'
1010import { getZodConstraint , parseWithZod } from '@conform-to/zod'
1111import { type Note , type NoteImage } from '@prisma/client'
12- import { type SerializeFrom } from 'react-router' ;
13- import { Form , useActionData } from 'react-router' ;
1412import { useState } from 'react'
13+ import { Form , useActionData , type useLoaderData } from 'react-router'
1514import { z } from 'zod'
1615import { GeneralErrorBoundary } from '#app/components/error-boundary.tsx'
1716import { floatingToolbarClassName } from '#app/components/floating-toolbar.tsx'
@@ -44,6 +43,8 @@ const ImageFieldsetSchema = z.object({
4443
4544export type ImageFieldset = z . infer < typeof ImageFieldsetSchema >
4645
46+ type SerializeFrom < T > = ReturnType < typeof useLoaderData < T > >
47+
4748export const NoteEditorSchema = z . object ( {
4849 id : z . string ( ) . optional ( ) ,
4950 title : z . string ( ) . min ( titleMinLength ) . max ( titleMaxLength ) ,
Original file line number Diff line number Diff line change 1- import { type SerializeFrom , useRouteLoaderData } from 'react-router'
1+ import { useRouteLoaderData } from 'react-router'
22import { type loader as rootLoader } from '#app/root.tsx'
33
4- function isUser ( user : any ) : user is SerializeFrom < typeof rootLoader > [ 'user' ] {
4+ function isUser (
5+ user : any ,
6+ ) : user is Awaited < ReturnType < typeof rootLoader > > [ 'data' ] [ 'user' ] {
57 return user && typeof user === 'object' && typeof user . id === 'string'
68}
79
You can’t perform that action at this time.
0 commit comments