featurehub-io / featurehub-javascript-sdk

Official FeatureHub Javascript, Typescript, React, SolidJS, Node SDKs
MIT License
6 stars 4 forks source link

Children of FeatureHub provider (react SDK) should be typed as ReactNode rather than JSX.Element #181

Closed GrandPoohBear closed 7 months ago

GrandPoohBear commented 10 months ago

Describe the bug The Typescript type definition specifies the children of the FeatureHub provider to be a JSX.Element. While this is true in most cases, the more accurate representation is ReactNode which can express things that React is willing to accept as children, like strings, numbers, booleans, etc. (see here for reference: https://www.totaltypescript.com/jsx-element-vs-react-reactnode). While this is a nitpicky thing, it does make for a conflict with some strict type systems.

Which area does this issue belong to?

To Reproduce Steps to reproduce the behavior:

  1. Use typescript
  2. In a component, add something like:
    return (
    <FeatureHub url="..." apiKey="...">{"Foo Bar Baz"}</FeatureHub>
    )
  3. See tsc fail, even though this is a valid (albeit contrived) example.

Expected behavior tsc would properly typecheck.

Versions

rvowles commented 9 months ago

Sorry, missed this PR. 👀

GrandPoohBear commented 9 months ago

No worries! Just kinda snuck up on y'all. 😜

rvowles commented 7 months ago

Forgot to close this issue with the merge!