Skip to content

Commit

Permalink
fix react types for nested arrays (#962)
Browse files Browse the repository at this point in the history
  • Loading branch information
gonpombo8 committed Jun 10, 2024
1 parent 0e1c091 commit daaaecf
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
9 changes: 3 additions & 6 deletions packages/@dcl/playground-assets/etc/playground-assets.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ export const enum CameraType {
// Warning: (ae-missing-release-tag) "Children" is part of the package's API, but it is missing a release tag (@alpha, @beta, @public, or @internal)
//
// @public (undocumented)
export type Children = ReactNode;
export type Children = ReactEcs.JSX.ReactNode;

// @public (undocumented)
export const enum ColliderLayer {
Expand Down Expand Up @@ -1012,7 +1012,7 @@ export const enum EasingFunction {
export interface EcsElements {
// (undocumented)
entity: Partial<EntityComponents> & {
children?: ReactNode;
children?: ReactEcs.JSX.ReactNode;
key?: Key;
};
}
Expand Down Expand Up @@ -3474,7 +3474,7 @@ export namespace ReactEcs {
export interface IntrinsicElements extends EcsElements {
}
// (undocumented)
export type ReactNode = ReactElement | string | number | boolean | null | undefined | ReactElement[];
export type ReactNode = Element | ReactElement | string | number | boolean | null | undefined | ReactNode[];
}
const // (undocumented)
createElement: any;
Expand All @@ -3497,9 +3497,6 @@ export interface ReactElement<P = any, T extends string | JSXElementConstructor<
type: T;
}

// @public (undocumented)
export type ReactNode = ReactElement | string | number | boolean | null | undefined;

// @public (undocumented)
export type ReadonlyComponentSchema<T extends [ComponentDefinition<unknown>, ...ComponentDefinition<unknown>[]]> = {
[K in keyof T]: T[K] extends ComponentDefinition<unknown> ? ReturnType<T[K]['get']> : never;
Expand Down
4 changes: 2 additions & 2 deletions packages/@dcl/react-ecs/src/components/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReactNode } from '../react-ecs'
import { ReactEcs } from '../react-ecs'
import { Listeners } from './listeners/types'
import { UiBackgroundProps } from './uiBackground/types'
import { UiTransformProps } from './uiTransform/types'
Expand All @@ -22,7 +22,7 @@ export interface EntityPropTypes extends Listeners {
* @public
*/
export type Key = number | string
export type Children = ReactNode
export type Children = ReactEcs.JSX.ReactNode

/**
* unit value type. i.e. 'vw' || 'vh'
Expand Down
9 changes: 2 additions & 7 deletions packages/@dcl/react-ecs/src/react-ecs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { Callback, Key } from './components'
* @public
*/
export interface EcsElements {
entity: Partial<EntityComponents> & { children?: ReactNode; key?: Key }
entity: Partial<EntityComponents> & { children?: ReactEcs.JSX.ReactNode; key?: Key }
}

/**
Expand Down Expand Up @@ -47,11 +47,6 @@ export interface ReactElement<
props: P
key: Key | null
}

/**
* @public
*/
export type ReactNode = ReactElement | string | number | boolean | null | undefined
/**
* @public
*/
Expand All @@ -60,7 +55,7 @@ export namespace ReactEcs {
/**
* @public
*/
export type ReactNode = ReactElement | string | number | boolean | null | undefined | ReactElement[]
export type ReactNode = Element | ReactElement | string | number | boolean | null | undefined | ReactNode[]
/**
* @public
*/
Expand Down

0 comments on commit daaaecf

Please sign in to comment.