zerodays / react-native-gen-ui

A Generative UI library for React Native.
https://www.npmjs.com/package/react-native-gen-ui
MIT License
78 stars 7 forks source link

Unable to add tools which are not async generators #12

Closed matejm closed 7 months ago

matejm commented 7 months ago

Current Behavior

Adding a tool which is an async generator works as it should. However in my case, tool will be a simple component displaying the data. No async requests are required. Cannot make typecheck to pass.

Expected Behavior

I want to return a simple component, by type checker wants me to use async generators.

Steps to Reproduce the Problem

  1. Follow the project setup in README.md
  2. Add the following tool:
    hangmanStatus: {
    description: "Return the current status of the hangman game.",
    parameters: z.object({ state: z.string() }),
    render: (data) => ({
      data,
      component: <TextInput value={data.state} />,
    }),
    },
  3. Get a TS error
    Type '{ data: { state: string; }; component: Element; }' is missing the following properties from type 'AsyncGenerator<ReactElement<any, string | JSXElementConstructor<any>>, ToolGeneratorReturn, unknown>': next, return, throw, [Symbol.asyncIterator]

Environment

zigapk commented 7 months ago

Good point 😃

github-actions[bot] commented 7 months ago

:tada: This issue has been resolved in version 1.3.0 :tada:

The release is available on:

Your semantic-release bot :package::rocket: