Skip to content

Fix children type for Fragment, StrictMode and Suspense #94

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions src/React.bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 9 additions & 25 deletions src/React.res
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,9 @@ external jsxs: (component<'props>, 'props) => element = "jsxs"
@module("react/jsx-runtime")
external jsxsKeyed: (component<'props>, 'props, ~key: string=?, @ignore unit) => element = "jsxs"

type fragmentProps<'children> = {children?: 'children}
type fragmentProps = {children?: element}

@module("react/jsx-runtime") external jsxFragment: component<fragmentProps<'children>> = "Fragment"
@module("react/jsx-runtime") external jsxFragment: component<fragmentProps> = "Fragment"

type ref<'value> = {mutable current: 'value}

Expand Down Expand Up @@ -104,43 +104,27 @@ external memoCustomCompareProps: (
@uncurry ('props, 'props) => bool,
) => component<'props> = "memo"

@module("react") external fragment: 'a = "Fragment"
@module("react") external fragment: component<fragmentProps> = "Fragment"

module Fragment = {
type props<'children> = {key?: string, children: 'children}
type props = {key?: string, children: element}

@module("react")
external make: component<props<'children>> = "Fragment"
external make: component<props> = "Fragment"
}

module StrictMode = {
type props<'children> = {key?: string, children: 'children}
type props = {key?: string, children: element}

@module("react")
external make: component<props<'children>> = "StrictMode"
external make: component<props> = "StrictMode"
}

module Suspense = {
type props<'children, 'fallback> = {key?: string, children?: 'children, fallback?: 'fallback}
type props = {key?: string, children?: element, fallback?: element}

@module("react")
external make: component<props<'children, 'fallback>> = "Suspense"
}

module Experimental = {
module SuspenseList = {
type revealOrder
type tail
type props<'children, 'revealOrder, 'tail> = {
key?: string,
children?: 'children,
revealOrder?: 'revealOrder,
tail?: 'tail,
}

@module("react")
external make: component<props<'children, 'revealOrder, 'tail>> = "SuspenseList"
}
external make: component<props> = "Suspense"
}

type dynamicallyImportedModule<'a> = {default: component<'a>}
Expand Down
7 changes: 0 additions & 7 deletions src/v3/React_V3.bs.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

22 changes: 0 additions & 22 deletions src/v3/React_V3.res
Original file line number Diff line number Diff line change
Expand Up @@ -134,28 +134,6 @@ module Suspense = {
}> = "Suspense"
}

module Experimental = {
module SuspenseList = {
type revealOrder = React.Experimental.SuspenseList.revealOrder
type tail = React.Experimental.SuspenseList.tail
@obj
external makeProps: (
~children: element=?,
~revealOrder: [#forwards | #backwards | #together]=?,
~tail: [#collapsed | #hidden]=?,
unit,
) => {"children": option<element>, "revealOrder": option<revealOrder>, "tail": option<tail>} =
""

@module("react")
external make: component<{
"children": option<element>,
"revealOrder": option<revealOrder>,
"tail": option<tail>,
}> = "SuspenseList"
}
}

/* HOOKS */

/*
Expand Down