Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better hints for 'cannot find name' errors #25309

Closed
DanielRosenwasser opened this issue Jun 28, 2018 · 4 comments
Closed

Better hints for 'cannot find name' errors #25309

DanielRosenwasser opened this issue Jun 28, 2018 · 4 comments
Assignees
Labels
Bug A bug in TypeScript Domain: Error Messages The issue relates to error messaging Fixed A PR has been merged for this issue

Comments

@DanielRosenwasser
Copy link
Member

Discussed at #25306

We found that for "Cannot find name" errors, certain identifiers were fairly frequent:

require, map, buffer, describe, $, asyncIterator, process, symbol, module, promise

We're thinking that we can elaborate beyond the usual error message.

  • $ => Suggest jQuery
  • describe => Did you mean to have types for mocha, jest, etc.?
  • process, require, module => Suggest including Node types
  • Symbol, Promise, Map, Set, WeakMap, WeakSet, Iterator, AsyncIterator => User needs to set a different lib or target.
@DanielRosenwasser
Copy link
Member Author

@bterlson @rbuckton @bowdenk7 any other suggestions?

@DanielRosenwasser DanielRosenwasser added Bug A bug in TypeScript Domain: Error Messages The issue relates to error messaging labels Jun 28, 2018
@DanielRosenwasser
Copy link
Member Author

There's also lib: dom in some circumstance https://twitter.com/_brotzky/status/1016915341694255104?s=19

@mhegazy
Copy link
Contributor

mhegazy commented Jul 11, 2018

@weswigham it will be nice to try to get this in sooner than 3.1 if we can.

@rbuckton
Copy link
Member

Possibly some common NodeJS imports: EventEmitter, Readable, Writable, fs (add a namespace import for "fs" module), path (namespace import for "path" module).

In the vein of path and fs, possibly suggestions for module names we can detect. For example, if you have the "vinyl" package and reference vinyl without an import, we could suggest the namespace import.

For things like EventEmitter, if we know that type exists in a module not imported, we could suggest the import (similar to how we already have a quick fix).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug A bug in TypeScript Domain: Error Messages The issue relates to error messaging Fixed A PR has been merged for this issue
Projects
None yet
Development

No branches or pull requests

4 participants