Skip to content

Declare types for node builtins modules within REPL virtual file #1424

@cspotcode

Description

@cspotcode

Node lets you do util.promisify() within the REPL without importing util because it declares getters for each builtin module.

However, ts-node doesn't tell typescript about these getters, so you'll still get TS errors if you try to util.promisify

We can add a bunch of declare const to the top of the REPL file so that all built-ins are declared.

Limitations:

  • Should gracefully skip when @types/node is not available

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions