Typescript: npm install without --save-dev suggested as Quick fix for missing type.

Created on 25 Sep 2020  路  4Comments  路  Source: microsoft/TypeScript




  • VSCode Version: 1.49.1
  • OS Version: macOS 10.15.6 (19G2021)

Steps to Reproduce:

  1. Create a Typescript Project
  2. Add an import x from async; ( or any other project without native types)
  3. The following error shows up.
Could not find a declaration file for module 'async'. '<path>' implicitly has an 'any' type.
Try `npm install @types/async` if it exists or add a new declaration (.d.ts) file containing `declare module 'async';`

The command listed is npm install @types/async but it should actually be npm install --save-dev @types/async as types are only a devDependency.

This is a simple text change, I can raise a PR if someone can point me towards the file throwing the error.


Does this issue occur when all extensions are disabled?: N/A

Error Messages Experience Enhancement Fix Available Suggestion good first issue help wanted

Most helpful comment

The quick fix for this runs npm install --save-dev so I think the string just needs to be updated too

All 4 comments

The quick fix for this runs npm install --save-dev so I think the string just needs to be updated too

I can raise a PR

Thanks!

  1. Update the message in this file: https://github.com/microsoft/TypeScript/blob/master/src/compiler/diagnosticMessages.json
  2. npm run build
  3. There will be a build error that points you to the place(s) that need to be updated subsequently

I'm also updating the install commands for node, jQuery, jest and mocha types.

Thanks!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

dlaberge picture dlaberge  路  3Comments

Roam-Cooper picture Roam-Cooper  路  3Comments

seanzer picture seanzer  路  3Comments

blendsdk picture blendsdk  路  3Comments

wmaurer picture wmaurer  路  3Comments