Importing IReact type definition

68 Views Asked by At

I have a variable that holds a Group Reference and when I call getClientRect() it returns the "IReact" type.

Since IReact is not in the default types index should I import the type from the internal types file or is there a better approach?

Simplified code reference:

import { IRect } from './../../../node_modules/konva/types/types';

const groupRef: React.RefObject<Konva.Group> = React.createRef();
const groupAttrsAux: IRect | undefined = groupRef.current?.getClientRect(null);
1

There are 1 best solutions below

2
On BEST ANSWER

You should never import from node_modules. Shouldn't this work?

import { IRect } from "konva/types/types";