Closed
Description
yarn init --yes
yarn add @types/acorn@4.0.3
With noImplicitAny
:
import * as acorn from "acorn/dist/acorn_loose";
Error:
Could not find a declaration file for module 'acorn/dist/acorn_loose'. 'c:/Users/Daniel/sample/node_modules/acorn/dist/acorn_loose.js' implicitly has an 'any' type.
Try `npm install @types/acorn` if it exists or add a new declaration (.d.ts) file containing `declare module 'acorn';`
But @types/acorn
already has been installed. The true error is that the declaration files haven't been written for this deeper import. I think we can give a better error message here.
Metadata
Metadata
Assignees
Labels
Type
Projects
Relationships
Development
No branches or pull requests
Activity
mhegazy commentedon Jun 8, 2018
The suggestion here is to make the error more helpful by checking the existence of the top-level package.