Skip to content

Commit ad0beaf

Browse files
chore: remove unnecessary type assertions (#6365)
Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
1 parent 31ae74f commit ad0beaf

File tree

17 files changed

+23
-32
lines changed

17 files changed

+23
-32
lines changed

packages/history/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ export function createHistory(opts: {
251251

252252
function assignKeyAndIndex(index: number, state: HistoryState | undefined) {
253253
if (!state) {
254-
state = {} as HistoryState
254+
state = {}
255255
}
256256
const key = createRandomKey()
257257
return {

packages/react-router/src/RouterProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export function RouterContextProvider<
3030
...router.options.context,
3131
...rest.context,
3232
},
33-
} as any)
33+
})
3434
}
3535

3636
const routerContext = getRouterContext()

packages/react-router/src/route.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ export function createRootRouteWithContext<TRouterContext extends {}>() {
465465
TLoaderFn,
466466
TSSR,
467467
TServerMiddlewares
468-
>(options as any)
468+
>(options)
469469
}
470470
}
471471

packages/router-core/src/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1942,7 +1942,7 @@ export class BaseRouteApi<TId, TRouter extends AnyRouter = RegisteredRouter> {
19421942
id: TId
19431943

19441944
constructor({ id }: { id: TId }) {
1945-
this.id = id as any
1945+
this.id = id
19461946
}
19471947

19481948
notFound = (opts?: NotFoundError) => {

packages/router-core/src/router.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2848,10 +2848,7 @@ export class RouterCore<
28482848
const matchLocation = {
28492849
...location,
28502850
to: location.to
2851-
? this.resolvePathWithBase(
2852-
(location.from || '') as string,
2853-
location.to as string,
2854-
)
2851+
? this.resolvePathWithBase(location.from || '', location.to as string)
28552852
: undefined,
28562853
params: location.params || {},
28572854
leaveParams: true,

packages/router-core/src/ssr/createRequestHandler.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ export function createRequestHandler<TRouter extends AnyRouter>({
6464
request,
6565
router,
6666
responseHeaders,
67-
} as any)
67+
})
6868
} finally {
6969
if (!cbWillCleanup) {
7070
// Clean up router SSR state if the callback won't handle it

packages/router-devtools-core/src/FloatingTanStackRouterDevtools.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ export function FloatingTanStackRouterDevtools({
246246
>
247247
{/* {router() ? ( */}
248248
<BaseTanStackRouterDevtoolsPanel
249-
ref={panelRef as any}
249+
ref={panelRef}
250250
{...otherPanelProps}
251251
router={router}
252252
routerState={routerState}

packages/solid-router/src/RouterProvider.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export function RouterContextProvider<
2626
...router.options.context,
2727
...rest.context,
2828
},
29-
} as any)
29+
})
3030

3131
const routerContext = getRouterContext()
3232

packages/solid-router/src/route.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,7 @@ export function createRootRouteWithContext<TRouterContext extends {}>() {
420420
TLoaderFn,
421421
TSSR,
422422
THandlers
423-
>(options as any)
423+
>(options)
424424
}
425425
}
426426

packages/start-client-core/src/createServerFn.ts

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import type {
2525
AnyFunctionMiddleware,
2626
AnyRequestMiddleware,
2727
AssignAllServerFnContext,
28-
FunctionMiddlewareClientFnResult,
2928
FunctionMiddlewareServerFnResult,
3029
IntersectAllValidatorInputs,
3130
IntersectAllValidatorOutputs,
@@ -65,7 +64,7 @@ export const createServerFn: CreateServerFn<Register> = (options, __opts) => {
6564
}
6665

6766
const res: ServerFnBuilder<Register, Method> = {
68-
options: resolvedOptions as any,
67+
options: resolvedOptions,
6968
middleware: (middleware) => {
7069
// multiple calls to `middleware()` merge the middlewares with the previously supplied ones
7170
// this is primarily useful for letting users create their own abstractions on top of `createServerFn`
@@ -280,8 +279,8 @@ export async function executeMiddleware(
280279
// Execute the middleware
281280
const result = await middlewareFn({
282281
...ctx,
283-
next: userNext as any,
284-
} as any)
282+
next: userNext,
283+
})
285284

286285
// If result is NOT a ctx object, we need to return it as
287286
// the { result }
@@ -782,11 +781,7 @@ function serverFnBaseToMiddleware(
782781
// but not before serializing the context
783782
const res = await options.extractedFn?.(payload)
784783

785-
return next(res) as unknown as FunctionMiddlewareClientFnResult<
786-
any,
787-
any,
788-
any
789-
>
784+
return next(res)
790785
},
791786
server: async ({ next, ...ctx }) => {
792787
// Execute the server function

0 commit comments

Comments
 (0)