microsoft / microsoft/TypeScript

Quick fix to install regular .js npm packages

Open
#20,649 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Domain: LS: Quick Fixes In Discussion Suggestion
Dominant language
Go
Stars
111k
Forks
14.3k
Avg merge
2d 4h
Merged PRs (30d)
132

Description

Let's say I start a new project. I start writing out an import for, say, express because I'm certain I'll be using that, but I haven't bothered to install it yet.

import express from "express";

Immediately, I might get an error like Cannot find module 'express'. because I didn't install the package before using it. This happens regardless of if I have noImplicitAny on. But this means I have to switch to a terminal and do an npm install.

We already give a quick fix to install missing @types packages, we should have a fix that

  1. Gives the option of installing a missing package as a dependency or a dev dependency.
  2. Also installs the types for that package if necessary in the same fashion.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the existing quick fix that installs missing @types packages and the handling of unresolved imports such as express. The work is done when a missing regular npm package can be installed as either a dependency or dev dependency, with its types installed in the corresponding fashion when needed.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, typescript
Domain
developer-experience, tooling
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.