File tree Expand file tree Collapse file tree 2 files changed +13
-6
lines changed
experimental/route-resolver/matchers Expand file tree Collapse file tree 2 files changed +13
-6
lines changed Original file line number Diff line number Diff line change 1+ import { identityFn } from '../../../utils'
12import { encodeParam } from '../../../encoding'
23import { warn } from '../../../warning'
34import { decode , MatcherQueryParams } from '../resolver-abstract'
@@ -289,13 +290,10 @@ export class MatcherPatternPathCustomParams<
289290 var currentMatch = ( match [ i + 1 ] as string | undefined ) ?? null
290291
291292 var value = paramOptions . repeat
292- ? ( currentMatch ?. split ( '/' ) || [ ] ) . map (
293- // using just decode makes the type inference fail
294- v => decode ( v )
295- )
293+ ? ( currentMatch ?. split ( '/' ) || [ ] ) . map < string > ( decode )
296294 : decode ( currentMatch )
297295
298- params [ paramName ] = ( paramOptions . get || ( v => v ) ) (
296+ params [ paramName ] = ( paramOptions . get || identityFn ) (
299297 value
300298 // NOTE: paramName and paramOptions are not connected from TS point of view
301299 )
@@ -325,7 +323,7 @@ export class MatcherPatternPathCustomParams<
325323 const paramName = this . paramsKeys [ paramIndex ++ ]
326324 const paramOptions = this . params [ paramName ]
327325 const value : ReturnType < NonNullable < Param_GetSet [ 'set' ] > > = (
328- paramOptions . set || ( v => v )
326+ paramOptions . set || identityFn
329327 ) ( params [ paramName ] )
330328
331329 return Array . isArray ( value )
Original file line number Diff line number Diff line change @@ -5,6 +5,15 @@ import {
55 RawRouteComponent ,
66} from '../types'
77
8+ /**
9+ * Identity function that returns the value as is.
10+ *
11+ * @param v - the value to return
12+ *
13+ * @internal
14+ */
15+ export const identityFn = < T > ( v : T ) => v
16+
817export * from './env'
918
1019/**
You can’t perform that action at this time.
0 commit comments