gvergnaud / hotscript

A library of composable functions for the type-level! Transform your TypeScript types in any way you want using functions you already know.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

question: inherit return type of type property

thereis opened this issue · comments

Hello, is it possible to inherit the return type dynamically of a given property? For example, let's assume we have a React component:

type InputProps = {
  value: string
}

export const Input: FC<InputProps> = () => (<></>);

And then, we have the following type:

type FormField = {
  component: Component | ForwardRefExoticComponent<any> | any;
  props: ??? // it should get the return 
 }

const fields: FormField[] = [
  {
      component: Input,
      props: { value: "test" }
  }
]

I've been trying this from the past few hours and couldn't achieve any valuable results.

Best.

commented

This is not an issue with hotscript.

please seek help in typescript dedicated discords for typescript related help.