Skip to content

Commit

Permalink
fix: correctly infer objectFields type from props
Browse files Browse the repository at this point in the history
Adjusted the ObjectField type definition to ensure that properties
present in Props are required and typed in the objectFields property.
This resolves an issue where properties were not being inferred, leading
to untyped fields.

Before:
<img width="422" alt="image"
src="https://github.com/measuredco/puck/assets/8417041/d690ae50-291a-4328-bc80-824873b14bca">

After:
<img width="774" alt="image"
src="https://github.com/measuredco/puck/assets/8417041/3d8f88b9-220a-4e80-9c7c-ba38eb14b583">
  • Loading branch information
hjbrand authored Mar 21, 2024
1 parent ca6bd5f commit e8991cc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/types/Config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ export type ObjectField<
> = BaseField & {
type: "object";
objectFields: {
[SubPropName in keyof Props[0]]: Field<Props[0][SubPropName]>;
[SubPropName in keyof Props]: Field<Props[SubPropName]>;
};
};

Expand Down

0 comments on commit e8991cc

Please sign in to comment.