File tree Expand file tree Collapse file tree 4 files changed +17
-12
lines changed
packages/route-pattern/bench/types Expand file tree Collapse file tree 4 files changed +17
-12
lines changed Original file line number Diff line number Diff line change @@ -17,8 +17,13 @@ bench('href > complex route', () => {
1717} ) . types ( [ 4575 , 'instantiations' ] )
1818
1919bench ( 'href > mediarss' , ( ) => {
20- type Route = keyof typeof import ( '../routes/mediarss.ts' ) . routes
21- let routes : { [ route in Route ] : RoutePattern < route > } = { } as any
20+ type Routes = typeof import ( '../routes/mediarss.ts' ) . routes
21+ let routes : { [ route in keyof Routes ] : RoutePattern < Routes [ route ] > } = { } as any
22+
23+ // @ts -expect-error missing required params: 'token'
24+ routes . feed . href ( )
25+ // @ts -expect-error missing required params: 'token'
26+ routes . feed . href ( { extra : '123' } )
2227
2328 routes . feed . href ( { token : '123' } )
2429 routes . media . href ( { token : '123' , path : 'users' } )
@@ -55,4 +60,4 @@ bench('href > mediarss', () => {
5560 routes . adminApiMediaStream . href ( { path : 'users' } )
5661 routes . adminApiMediaUpload . href ( )
5762 routes . adminApiArtwork . href ( { path : 'users' } )
58- } ) . types ( [ 39583 , 'instantiations' ] )
63+ } ) . types ( [ 79421 , 'instantiations' ] )
Original file line number Diff line number Diff line change @@ -17,8 +17,8 @@ bench('Join', () => {
1717
1818bench ( 'join > mediarss' , ( ) => {
1919 const other = '/comments/:commentId'
20- type Route = keyof typeof import ( '../routes/mediarss.ts' ) . routes
21- let routes : { [ route in Route ] : RoutePattern < route > } = { } as any
20+ type Routes = typeof import ( '../routes/mediarss.ts' ) . routes
21+ let routes : { [ route in keyof Routes ] : RoutePattern < Routes [ route ] > } = { } as any
2222
2323 routes . feed . join ( other )
2424 routes . media . join ( other )
@@ -55,4 +55,4 @@ bench('join > mediarss', () => {
5555 routes . adminApiMediaStream . join ( other )
5656 routes . adminApiMediaUpload . join ( other )
5757 routes . adminApiArtwork . join ( other )
58- } ) . types ( [ 44665 , 'instantiations' ] )
58+ } ) . types ( [ 81580 , 'instantiations' ] )
Original file line number Diff line number Diff line change @@ -16,8 +16,8 @@ bench('new > complex route', () => {
1616} ) . types ( [ 3 , 'instantiations' ] )
1717
1818bench ( 'new > mediarss' , ( ) => {
19- type Route = keyof typeof import ( '../routes/mediarss.ts' ) . routes
20- let routes : { [ route in Route ] : RoutePattern < route > } = { } as any
19+ type Routes = typeof import ( '../routes/mediarss.ts' ) . routes
20+ let routes : { [ route in keyof Routes ] : RoutePattern < Routes [ route ] > } = { } as any
2121
2222 routes . feed
2323 routes . media
@@ -54,4 +54,4 @@ bench('new > mediarss', () => {
5454 routes . adminApiMediaStream
5555 routes . adminApiMediaUpload
5656 routes . adminApiArtwork
57- } ) . types ( [ 64 , 'instantiations' ] )
57+ } ) . types ( [ 128 , 'instantiations' ] )
Original file line number Diff line number Diff line change @@ -19,8 +19,8 @@ bench('params > complex route', () => {
1919} ) . types ( [ 3804 , 'instantiations' ] )
2020
2121bench ( 'params > mediarss' , ( ) => {
22- type Route = keyof typeof import ( '../routes/mediarss.ts' ) . routes
23- let routes : { [ route in Route ] : RoutePattern < route > } = { } as any
22+ type Routes = typeof import ( '../routes/mediarss.ts' ) . routes
23+ let routes : { [ route in keyof Routes ] : RoutePattern < Routes [ route ] > } = { } as any
2424 let url : URL = { } as any
2525
2626 routes . feed . match ( url ) ?. params
@@ -58,4 +58,4 @@ bench('params > mediarss', () => {
5858 routes . adminApiMediaStream . match ( url ) ?. params
5959 routes . adminApiMediaUpload . match ( url ) ?. params
6060 routes . adminApiArtwork . match ( url ) ?. params
61- } ) . types ( [ 39534 , 'instantiations' ] )
61+ } ) . types ( [ 74851 , 'instantiations' ] )
You can’t perform that action at this time.
0 commit comments