I am trying to setState from a specific component like this.
const [paramList, setParamList] = useState<Parameters<any>[] | undefined>();
the component type is like that
type Parameters<T extends (...args: any) => any> = T extends (...args: infer P) => any ? P : never;
but when try to setParamlist it shows error as below.
setParamList(renderState.parameters);
(parameter) renderState: RenderState
Argument of type 'ReadonlyMap<string, any> | undefined' is not assignable to parameter of type 'SetStateAction<unknown[][] | undefined>'.
Type 'ReadonlyMap<string, any>' is not assignable to type 'SetStateAction<unknown[][] | undefined>'.
Type 'ReadonlyMap<string, any>' is missing the following properties from type 'unknown[][]': length, pop, push, concat, and 24 more.ts(2345)
I found solution for this. It should be in Array.
const [paramList, setParamList] = useState<Array<Parameter>>();