File tree Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Expand file tree Collapse file tree 3 files changed +17
-6
lines changed Original file line number Diff line number Diff line change @@ -375,10 +375,8 @@ export interface Ref<T> {
375375// @alpha
376376export const render: (parent : Element | Document , jsxNode : JSXNode <unknown > | FunctionComponent <any >, allowRerender ? : boolean ) => Promise <void >;
377377
378- // Warning: (ae-forgotten-export) The symbol "AsyncProps" needs to be exported by the entry point index.d.ts
379- //
380378// @alpha (undocumented)
381- export const Resource: <T >(props : AsyncProps <T >) => JSXNode ;
379+ export const Resource: <T >(props : ResourceProps <T >) => JSXNode ;
382380
383381// @alpha (undocumented)
384382export interface ResourceCtx <T > {
@@ -402,6 +400,18 @@ export interface ResourcePending<T> {
402400 state: ' pending' ;
403401}
404402
403+ // @alpha (undocumented)
404+ export interface ResourceProps <T > {
405+ // (undocumented)
406+ onPending? : () => JSXNode ;
407+ // (undocumented)
408+ onRejected? : (reason : any ) => JSXNode ;
409+ // (undocumented)
410+ onResolved: (value : T ) => JSXNode ;
411+ // (undocumented)
412+ resource: ResourceReturn <T >;
413+ }
414+
405415// @alpha (undocumented)
406416export interface ResourceRejected <T > {
407417 // (undocumented)
Original file line number Diff line number Diff line change @@ -48,6 +48,7 @@ export type {
4848 ResourceResolved ,
4949} from './use/use-watch' ;
5050export { useWatch$ , useWatchQrl } from './use/use-watch' ;
51+ export type { ResourceProps } from './use/use-resource' ;
5152export { useResource$ , useResourceQrl , Resource } from './use/use-resource' ;
5253export { useClientEffect$ , useClientEffectQrl } from './use/use-watch' ;
5354export { useServerMount$ , useServerMountQrl } from './use/use-watch' ;
Original file line number Diff line number Diff line change @@ -69,7 +69,7 @@ export const useIsServer = () => {
6969/**
7070 * @alpha
7171 */
72- export interface AsyncProps < T > {
72+ export interface ResourceProps < T > {
7373 resource : ResourceReturn < T > ;
7474 onResolved : ( value : T ) => JSXNode ;
7575 onPending ?: ( ) => JSXNode ;
@@ -79,7 +79,7 @@ export interface AsyncProps<T> {
7979/**
8080 * @alpha
8181 */
82- export const Resource = < T > ( props : AsyncProps < T > ) : JSXNode => {
82+ export const Resource = < T > ( props : ResourceProps < T > ) : JSXNode => {
8383 const isBrowser = ! qDev || ! useIsServer ( ) ;
8484 if ( isBrowser ) {
8585 if ( props . onRejected ) {
@@ -98,7 +98,7 @@ export const Resource = <T>(props: AsyncProps<T>): JSXNode => {
9898 }
9999 }
100100
101- // Async path
101+ // Resource path
102102 return jsx ( Fragment , {
103103 children : props . resource . promise . then ( props . onResolved , props . onRejected ) ,
104104 } ) ;
You can’t perform that action at this time.
0 commit comments