I'm converting a React project from using JSX to using TSX files.
I need full preview of types of one constant:
const canvasProps = {
setPorts,
setBoxes,
setLines,
selected,
setSelected,
actionState,
setActionState,
... // and more
};
on hover on canvasProps I get the preview:
const canvasProps: {
setPorts: React.Dispatch<React.SetStateAction<{
shape: string;
id: string;
name: string;
port: portType;
ref: any;
}[]>>;
setBoxes: React.Dispatch<React.SetStateAction<BoxType[]>>;
... 13 more ...;
toggleFlowVisibility: (flow: any) => void;
}
I need to get the full type definition of this constant, which means see the extra 13 types.
(I need this because I need to declare the properties of React.Context, which depends on functions that have not declared yet (inside a function component) )
So how can I get the full type definition without working hard?
canvasPropscomes from? Is it an object you declared, or is it declared by 3rd party?React.createContextoutside the main component so all the other children will be able to import it, so I need to predefine the types of each var in this object.