1- /* eslint-disable @typescript-eslint/ban-ts-comment */
21import { Entity , schema } from '@data-client/endpoint' ;
32import { useController , useSuspense } from '@data-client/react' ;
43import { User } from '__tests__/new' ;
@@ -197,31 +196,31 @@ it('should precisely type function arguments', () => {
197196 // path: '/todos/:id?'
198197 ( ) => {
199198 const optionalUndefSearch = new RestEndpoint ( {
200- path : '/todos/:id? ' ,
199+ path : '/todos{ /:id} ' ,
201200 searchParams : { } as
202201 | {
203202 userId ?: string | number ;
204203 }
205204 | undefined ,
206205 } ) ;
207206 const optionalSearch = new RestEndpoint ( {
208- path : '/todos/:id? ' ,
207+ path : '/todos{ /:id} ' ,
209208 searchParams : { } as {
210209 userId ?: string | number ;
211210 } ,
212211 } ) ;
213212 const undef = new RestEndpoint ( {
214- path : '/todos/:id? ' ,
213+ path : '/todos{ /:id} ' ,
215214 searchParams : undefined ,
216215 } ) ;
217216 const requiredSearch = new RestEndpoint ( {
218- path : '/todos/:id? ' ,
217+ path : '/todos{ /:id} ' ,
219218 searchParams : { } as {
220219 userId : string | number ;
221220 } ,
222221 } ) ;
223222 const noSearch = new RestEndpoint ( {
224- path : '/todos/:id? ' ,
223+ path : '/todos{ /:id} ' ,
225224 } ) ;
226225 ( ) => optionalUndefSearch ( ) ;
227226 ( ) => optionalUndefSearch ( { } ) ;
@@ -573,20 +572,19 @@ it('should handle more open ended type definitions', () => {
573572
574573( ) => {
575574 const getThing = new RestEndpoint ( {
576- path : '/:id* :bob' ,
575+ path : '{/*id} :bob' ,
577576 } ) ;
578577
579578 getThing ( { id : 5 , bob : 'hi' } ) ;
580579 // @ts -expect-error
581580 getThing ( { id : 'hi' } ) ;
582- // @ts -expect-error
583581 getThing ( { bob : 'hi' } ) ;
584582 // @ts -expect-error
585583 getThing ( 5 ) ;
586584} ;
587585( ) => {
588586 const getThing = new RestEndpoint ( {
589- path : '/:id+ :bob' ,
587+ path : '/*id :bob' ,
590588 } ) ;
591589
592590 getThing ( { id : 5 , bob : 'hi' } ) ;
@@ -601,7 +599,7 @@ it('should handle more open ended type definitions', () => {
601599} ;
602600( ) => {
603601 const getThing = new RestEndpoint ( {
604- path : '/:id\\+ :bob' ,
602+ path : '/:id\\, :bob' ,
605603 } ) ;
606604
607605 getThing ( { id : 5 , bob : 'hi' } ) ;
@@ -616,7 +614,7 @@ it('should handle more open ended type definitions', () => {
616614} ;
617615( ) => {
618616 const getThing = new RestEndpoint ( {
619- path : '/:id: bob+ ' ,
617+ path : '/:id/* bob' ,
620618 } ) ;
621619
622620 getThing ( { id : 5 , bob : 'hi' } ) ;
@@ -631,7 +629,7 @@ it('should handle more open ended type definitions', () => {
631629} ;
632630( ) => {
633631 const getThing = new RestEndpoint ( {
634- path : '/:foo/(.* )' ,
632+ path : '/:foo/(.)' ,
635633 } ) ;
636634
637635 getThing ( { foo : 'hi' } ) ;
@@ -644,7 +642,7 @@ it('should handle more open ended type definitions', () => {
644642} ;
645643( ) => {
646644 const getThing = new RestEndpoint ( {
647- path : '/:attr1? {-:attr2}? {-:attr3}? ' ,
645+ path : '{ /:attr1} {-:attr2}{-:attr3}' ,
648646 } ) ;
649647
650648 getThing ( { attr1 : 'hi' } ) ;
0 commit comments