I had this error in a typescript project:

error TS7022: 'path' implicitly has type 'any' because it does not have a type annotation and i s referenced directly or indirectly in its own initializer.

The code: 

const path = this.getPath(item.children, val);


Typescript needs to be sure what type this.getPath will return. In this case, i casted it to "any":

const path: any = this.getPath(item.children, val);