Created
January 5, 2026 05:10
-
-
Save hxtree/4b6af8affd602bc8f3cdf6daa46ee7e8 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Recursive personalization contract | |
| export type Personalization<T> = { | |
| type: "merge" | "replace"; // merge = selective, replace = full | |
| value: Partial<T> | T; | |
| nested?: { [K in keyof T]?: Personalization<T[K]> }; | |
| }; | |
| const itemListPersonalization: Personalization<ItemListProps> = { | |
| type: "merge", // merge at the list level | |
| nested: { | |
| items: { | |
| type: "merge", // merge the items array | |
| nested: { | |
| 2: { // 0-based index → Item 3 | |
| type: "replace", // fully replace this item | |
| value: { | |
| title: "Completely New Item 3", | |
| button: { label: "Buy Now", color: "red" }, | |
| }, | |
| }, | |
| }, | |
| }, | |
| }, | |
| }; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment