Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion renderers/web_core/src/v0_8/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ export type ResolvedValue =
| ResolvedArray;

/** A generic map where each value has been recursively resolved. */
export type ResolvedMap = { [key: string]: ResolvedValue };
export type ResolvedMap = { [key: string]?: ResolvedValue };
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

This change does not fix the underlying type issue. An object with optional properties (e.g., prop?: T) is not assignable to {[key: string]?: T} because the type of the optional property is T | undefined, which is not assignable to T. In this case, ResolvedValue does not include undefined.

To correctly fix the type assignability for objects with optional properties, the value type of the index signature must include undefined.

While this is a significant change to the type definition, it appears safe with respect to the current implementation of resolvePropertyValue, which does not produce undefined values. This change is necessary to correctly type the relationship between primitive objects with optional fields and ResolvedMap.

Suggested change
export type ResolvedMap = { [key: string]?: ResolvedValue };
export type ResolvedMap = { [key: string]: ResolvedValue | undefined };


/** A generic array where each item has been recursively resolved. */
export type ResolvedArray = ResolvedValue[];
Expand Down
Loading