Skip to content

Type safe allow and disallow#1572

Open
DamianKocjan wants to merge 5 commits intopuckeditor:mainfrom
DamianKocjan:feat-typed-allow-disallow
Open

Type safe allow and disallow#1572
DamianKocjan wants to merge 5 commits intopuckeditor:mainfrom
DamianKocjan:feat-typed-allow-disallow

Conversation

@DamianKocjan
Copy link
Contributor

Closes #1099

Description

This PR introduces type safety for the allow and disallow props within Puck's Slot/DropZone.

Changes made

Updated DropZoneProps to use the generic component type for allow and disallow arrays.

How to test

Open a component configuration in a TypeScript environment (e.g., apps/demo/config/blocks/Flex/index.tsx).

Ensure the component is typed using the new generic: ComponentConfig<Props, keyof Components>.

Inside the render function, find a Slot.

Try to add an allow prop:

<Slot allow={["NonExistentComponent"]} /> 

Verify: TypeScript should throw an error because "NonExistentComponent" is not a key in your Components type.

Verify: Triggering autocomplete within the allow array should suggest valid component names from your config.

@vercel
Copy link

vercel bot commented Feb 17, 2026

@DamianKocjan is attempting to deploy a commit to the Puck Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ability to make allow and disallow type safe

1 participant