@remote-ui/react
Advanced tools
Comparing version
@@ -7,7 +7,7 @@ import type { ReactNode, ComponentType, ReactElement } from 'react'; | ||
type RemoteFragmentToReactElement<T> = T extends RemoteFragment<infer R> ? ReactElement | false | RemoteFragment<R> : T; | ||
export type ReactPropsFromRemoteComponentType<Type extends RemoteComponentType<string, any, any>> = PropsForRemoteComponent<Type> & { | ||
export type ReactPropsFromRemoteComponentType<Type extends RemoteComponentType<string, any, any>> = PropsForRemoteComponent<Type> & (Type extends RemoteComponentType<string, any, infer Children> ? false extends Children ? {} : { | ||
children?: ReactNode; | ||
}; | ||
} : {}); | ||
export type ReactComponentTypeFromRemoteComponentType<Type extends RemoteComponentType<string, any, any>> = ComponentType<ReactPropsFromRemoteComponentType<Type>>; | ||
export {}; | ||
//# sourceMappingURL=types.d.ts.map |
# Changelog | ||
## 5.0.4 | ||
### Patch Changes | ||
- [#261](https://github.com/Shopify/remote-ui/pull/261) [`4c7ba1a`](https://github.com/Shopify/remote-ui/commit/4c7ba1a2528711f5771bba18d03e63d79c3be202) Thanks [@lemonmade](https://github.com/lemonmade)! - Fix React `children` type for remote components without children | ||
## 5.0.3 | ||
@@ -4,0 +10,0 @@ |
{ | ||
"name": "@remote-ui/react", | ||
"version": "5.0.3", | ||
"version": "5.0.4", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public", |
@@ -23,10 +23,10 @@ # `@remote-ui/react` | ||
**React 17.x.x**: you will need to have React installed. Additionally, if you are in the “remote” environment, you will need a dependency on `react-reconciler` between greater than or equal to `0.26.0`, and less than `0.28.0`: | ||
**React 17.x.x**: you will need to have React installed. Additionally, if you are in the “remote” environment, you will need a dependency on `react-reconciler` greater than or equal to `0.26.0`, and less than `0.27.0`: | ||
``` | ||
yarn add react@^17.0.0 react-reconciler@^0.27.0 | ||
yarn add react@^17.0.0 react-reconciler@~0.26.0 | ||
# or, with `npm`: | ||
npm install react@^17.0.0 react-reconciler@^0.27.0 --save | ||
npm install react@^17.0.0 react-reconciler@~0.26.0 --save | ||
``` | ||
@@ -33,0 +33,0 @@ |
@@ -19,7 +19,14 @@ import type {ReactNode, ComponentType, ReactElement} from 'react'; | ||
/* eslint-disable @typescript-eslint/ban-types */ | ||
export type ReactPropsFromRemoteComponentType< | ||
Type extends RemoteComponentType<string, any, any>, | ||
> = PropsForRemoteComponent<Type> & { | ||
children?: ReactNode; | ||
}; | ||
> = PropsForRemoteComponent<Type> & | ||
(Type extends RemoteComponentType<string, any, infer Children> | ||
? false extends Children | ||
? {} | ||
: { | ||
children?: ReactNode; | ||
} | ||
: {}); | ||
/* eslint-enable @typescript-eslint/ban-types */ | ||
@@ -26,0 +33,0 @@ export type ReactComponentTypeFromRemoteComponentType< |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
190504
0.39%3001
0.23%