WrapNodes TypeAlias
Type TreeNodes in T as PropTreeNodes.
This API is provided as an alpha preview and may change without notice.
To use, import via @fluidframework/react/alpha.
For more information about our API support guarantees, see here.
Signature
export type WrapNodes<T> = T extends TreeNode ? PropTreeNode<T> : T extends readonly (infer U)[] ? readonly WrapNodes<U>[] : T extends infer U ? IsMappableObjectType<U, {
[P in keyof U]: WrapNodes<U[P]>;
} extends U ? U : {
[P in keyof U]: WrapNodes<U[P]>;
}, T> : T;
Type Parameters
| Parameter | Description |
|---|---|
| T |
Remarks
This only handles a few cases (TreeNode, structurally typed objects fields and arrays) and leaves other types as is. Users which provide other types (e.g. maps) which contain TreeNodes will need to handle wrapping those themselves if the wrapping is desired.
Users of this should not rely on a given use of TreeNode not being wrapped: future changes to this API may add more cases which are wrapped, and this will be considered a non-breaking change.