Skip to content

Commit

Permalink
fix: remove possibility to write a 'input' layout element
Browse files Browse the repository at this point in the history
  • Loading branch information
Enki Pontvianne committed Sep 17, 2024
1 parent be5a13c commit 3cb228e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { ActionLayoutElement, CompositeId, File, Json } from '@forestadmin/datasource-toolkit';
import {
ActionLayoutElement,
CompositeId,
File,
Json,
LayoutElementInput,
} from '@forestadmin/datasource-toolkit';

type UnionKeys<T> = T extends T ? keyof T : never;
type StrictUnionHelper<T, TAll> = T extends any

Check warning on line 10 in packages/datasource-customizer/src/decorators/actions/types/fields.ts

View workflow job for this annotation

GitHub Actions / Linting & Testing (datasource-customizer)

Unexpected any. Specify a different type
Expand Down Expand Up @@ -241,7 +247,10 @@ export type DynamicField<Context = unknown> = StrictUnion<
| (FileListDynamicField<Context> & FileListPickerFieldConfiguration)
>;

export type DynamicLayoutElement<Context = unknown> = ActionLayoutElement & {
export type DynamicLayoutElement<Context = unknown> = Exclude<
ActionLayoutElement,
LayoutElementInput
> & {
if?: ((context: Context) => Promise<unknown>) | ((context: Context) => unknown);
};

Expand Down
2 changes: 1 addition & 1 deletion packages/datasource-toolkit/src/interfaces/action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ interface LayoutElementSeparator extends ActionLayoutElementBase {
component: 'Separator';
}

interface LayoutElementInput extends ActionLayoutElementBase {
export interface LayoutElementInput extends ActionLayoutElementBase {
component: 'Input';
fieldId: string;
}
Expand Down

0 comments on commit 3cb228e

Please sign in to comment.