@yahoo/uds-create-config 5.67.4 → 5.68.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -907,15 +907,24 @@ type AuthoredComponent = ComponentBuilder<LayerMap, PropMap, unknown, unknown>;
907
907
  * The builder is read off `metadata()`'s return type, so a handle with statics on it (the Bridge's
908
908
  * `Menu.Item`) is matched as the bare builder and keeps its statics. Matched whole, a handle whose
909
909
  * statics are builders too passes TypeScript's complexity limit (TS2859) once a system's style props
910
- * are registered.
911
- *
912
- * OPEN: a static that is the component itself (`Menu.Content`) keeps the source's types.
910
+ * are registered. A static that is the component itself (`Menu.Content`) is the rebuilt handle too.
913
911
  */
914
912
  type LinkedHandle<Handle, Props extends PropMap = Record<never, never>, Layers extends Record<string, LayerElement> = Record<never, never>> = Handle extends {
915
913
  metadata(meta: never): infer Builder;
916
- } ? Builder extends ComponentBuilder<infer L extends LayerMap, infer P extends PropMap, infer E, infer D, infer F extends string, infer S extends StateMap> ? WithStatics<ComponentBuilder<Without<L, keyof Layers> & Layers extends infer Swapped extends LayerMap ? Swapped : L, CompactProps<Without<P, keyof Props> & Props>, E, D, F, S>, Omit<Handle, keyof Builder>> : Handle : Handle;
917
- /** A rebuilt handle with the source handle's statics beside it, when it has any. */
918
- type WithStatics<Rebuilt, Statics> = [keyof Statics] extends [never] ? Rebuilt : Rebuilt & Statics;
914
+ } ? Builder extends ComponentBuilder<infer L extends LayerMap, infer P extends PropMap, infer E, infer D, infer F extends string, infer S extends StateMap> ? WithStatics<ComponentBuilder<Without<L, keyof Layers> & Layers extends infer Swapped extends LayerMap ? Swapped : L, CompactProps<Without<P, keyof Props> & Props>, E, D, F, S>, Builder, Omit<Handle, keyof Builder>> : Handle : Handle;
915
+ /**
916
+ * A rebuilt handle with the source handle's statics beside it, when it has any. A static whose
917
+ * builder is the handle's own is the rebuilt handle, with that static's own statics beside it.
918
+ */
919
+ type WithStatics<Rebuilt, Builder, Statics> = [keyof Statics] extends [never] ? Rebuilt : Rebuilt & { [K in keyof Statics]: IsBuilder<Statics[K], Builder> extends true ? Rebuilt & Omit<Statics[K], keyof Builder> : Statics[K] };
920
+ /**
921
+ * Whether a static's builder is the handle's own. An identity check, which TypeScript answers at
922
+ * once when both are the same type: an assignability check would compare the two builders whole,
923
+ * as the TS2859 above did.
924
+ */
925
+ type IsBuilder<Static, Builder> = Static extends {
926
+ metadata(meta: never): infer Own;
927
+ } ? (<T>() => T extends Own ? 1 : 2) extends (<T>() => T extends Builder ? 1 : 2) ? true : false : false;
919
928
  interface DefineComponent {
920
929
  /** The one-layer form: the element IS the component. */
921
930
  <const El extends LayerElement>(element: El): ComponentBuilder<{