镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content

Better hints for 'cannot find name' errors #25309

Description

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.

Activity

  1. DanielRosenwasser commented on Jun 28, 2018

    @DanielRosenwasser
    MemberAuthor
  2. DanielRosenwasser commented on Jul 11, 2018

    @DanielRosenwasser
    MemberAuthor

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

  3. mhegazy commented on Jul 11, 2018

    @mhegazy
    Contributor

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

  4. rbuckton commented on Jul 11, 2018

    @rbuckton
    Contributor

    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).

  5. locked as resolved and limited conversation to collaborators on Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

BugA bug in TypeScriptDomain: Error MessagesThe issue relates to error messagingFixedA PR has been merged for this issue

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions