From ff18b3f8b7c8dbc97be588f699d539226785343a Mon Sep 17 00:00:00 2001 From: Ashot Nazaryan Date: Tue, 10 Oct 2023 19:31:16 -0700 Subject: [PATCH] fix(core): context.path is now typed correctly (#3303) --- packages/feathers/src/declarations.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/packages/feathers/src/declarations.ts b/packages/feathers/src/declarations.ts index ee44b59fd0..aece46eebd 100644 --- a/packages/feathers/src/declarations.ts +++ b/packages/feathers/src/declarations.ts @@ -3,6 +3,10 @@ import { NextFunction, HookContext as BaseHookContext } from '@feathersjs/hooks' type SelfOrArray = S | S[] type OptionalPick = Pick> +type Entries = { + [K in keyof T]: [K, T[K]] +}[keyof T][] +type GetKeyByValue = Extract[number], [PropertyKey, Value]>[0] export type { NextFunction } @@ -355,6 +359,8 @@ export interface Http { export type HookType = 'before' | 'after' | 'error' | 'around' +type Serv = FA extends Application ? S : never + export interface HookContext extends BaseHookContext> { /** * A read only property that contains the Feathers application object. This can be used to @@ -370,7 +376,7 @@ export interface HookContext extends BaseHookContext & string : GetKeyByValue, S> & string /** * A read only property and contains the service this hook currently runs on. */