Errors 10 exercises

Fixing "Could Not Find A Declaration File"

This exercise also includes its own small directory.

Inside of the index.ts file, we have a single import:

import Diff from "diff"; // red squiggly line under diff

There is an error under diff that reads:

// hovering over diff shows:
Could not find a declarati

Loading exercise


00:00 In this exercise, we have a single import Insider application, import diff from diff. Inside here, it's basically saying, could not find a declaration file for module diff. Implicitly hasn't any type. Try something if it exists or add a new declaration file containing declare module diff.

00:19 Now, this is annoying because we have a package.json inside here. This package.json has a dependency on diff, and we can see that inside Node modules, we have diff is there. It has all of its code. Why isn't it letting us use it in TypeScript? This is really, really annoying.

00:37 So see if there's a way that you can solve this error, possibly by using the actual error itself to tell you how it might solve it. I'll see you on the other side to explain why this error is even occurring. Good luck.