@b9g/crank 0.5.1 → 0.5.2

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.
package/crank.d.ts CHANGED
@@ -377,20 +377,20 @@ declare class ContextImpl<TNode = unknown, TScope = unknown, TRoot extends TNode
377
377
  constructor(renderer: RendererImpl<TNode, TScope, TRoot, TResult>, root: TRoot | undefined, host: Retainer<TNode>, parent: ContextImpl<TNode, TScope, TRoot, TResult> | undefined, scope: TScope | undefined, ret: Retainer<TNode>);
378
378
  }
379
379
  declare const _ContextImpl: unique symbol;
380
- type ComponentProps<T> = T extends (props: infer U) => any ? U : T;
380
+ type ComponentProps<T> = T extends () => any ? {} : T extends (props: infer U) => any ? U : T;
381
381
  /**
382
382
  * A class which is instantiated and passed to every component as its this
383
383
  * value. Contexts form a tree just like elements and all components in the
384
384
  * element tree are connected via contexts. Components can use this tree to
385
385
  * communicate data upwards via events and downwards via provisions.
386
386
  *
387
- * @template [TProps=*] - The expected shape of the props passed to the
388
- * component. Used to strongly type the Context iterator methods.
387
+ * @template [T=*] - The expected shape of the props passed to the component,
388
+ * or a component function. Used to strongly type the Context iterator methods.
389
389
  * @template [TResult=*] - The readable element value type. It is used in
390
390
  * places such as the return value of refresh and the argument passed to
391
391
  * schedule and cleanup callbacks.
392
392
  */
393
- export declare class Context<TProps = any, TResult = any> implements EventTarget {
393
+ export declare class Context<T = any, TResult = any> implements EventTarget {
394
394
  /**
395
395
  * @internal
396
396
  */
@@ -403,7 +403,7 @@ export declare class Context<TProps = any, TResult = any> implements EventTarget
403
403
  * component or via the context iterator methods. This property is mainly for
404
404
  * plugins or utilities which wrap contexts.
405
405
  */
406
- get props(): ComponentProps<TProps>;
406
+ get props(): ComponentProps<T>;
407
407
  /**
408
408
  * The current value of the associated element.
409
409
  *
@@ -412,8 +412,8 @@ export declare class Context<TProps = any, TResult = any> implements EventTarget
412
412
  * mainly for plugins or utilities which wrap contexts.
413
413
  */
414
414
  get value(): TResult;
415
- [Symbol.iterator](): Generator<ComponentProps<TProps>>;
416
- [Symbol.asyncIterator](): AsyncGenerator<ComponentProps<TProps>>;
415
+ [Symbol.iterator](): Generator<ComponentProps<T>>;
416
+ [Symbol.asyncIterator](): AsyncGenerator<ComponentProps<T>>;
417
417
  /**
418
418
  * Re-executes a component.
419
419
  *
package/crank.js CHANGED
@@ -859,8 +859,8 @@ const _ContextImpl = Symbol.for("crank.ContextImpl");
859
859
  * element tree are connected via contexts. Components can use this tree to
860
860
  * communicate data upwards via events and downwards via provisions.
861
861
  *
862
- * @template [TProps=*] - The expected shape of the props passed to the
863
- * component. Used to strongly type the Context iterator methods.
862
+ * @template [T=*] - The expected shape of the props passed to the component,
863
+ * or a component function. Used to strongly type the Context iterator methods.
864
864
  * @template [TResult=*] - The readable element value type. It is used in
865
865
  * places such as the return value of refresh and the argument passed to
866
866
  * schedule and cleanup callbacks.