Skip to content

Commit

Permalink
fix(type): add generic for SmartActionRequestBody (#1024)
Browse files Browse the repository at this point in the history
Co-authored-by: Justin Martin <[email protected]>
  • Loading branch information
arnaud-moncel and JustinMartinDev authored Oct 25, 2022
1 parent 15a6747 commit bcd16af
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ interface ActionRequestBody {
}

// Base body from requests for classic smart action routes
interface SmartActionRequestBody {
interface SmartActionRequestBody<T extends Record<string, any> = Record<string, any>> {
data: {
attributes: ActionRequestAttributes & { values: Record<string, any> },
attributes: ActionRequestAttributes & { values: T },
type: 'custom-action-requests',
},
}
Expand All @@ -91,8 +91,8 @@ interface SmartActionHookRequestBody {
}

// Concrete smart action request for classic smart action routes
export interface SmartActionRequest extends ForestRequest {
body: SmartActionRequestBody,
export interface SmartActionRequest<T extends Record<string, any> = Record<string, any>> extends ForestRequest {
body: SmartActionRequestBody<T>,
}

// Request passed to smart action load hooks
Expand Down

0 comments on commit bcd16af

Please sign in to comment.