microsoft / microsoft/TypeScript

Quick fix to install regular .js npm packages

未关闭
#20,649 0 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

Domain: LS: Quick Fixes In Discussion Suggestion
主要语言
Go
星标
111k
派生
14.3k
平均合并
2 天 4 小时
30 天内合并 PR
132

描述

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.

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

调研方向

首先跟踪现有的 quick fix,该 quick fix 会安装缺失的 @types 包,并处理未解析的导入(例如 express)。当缺失的普通 npm 包可以作为依赖或开发依赖安装,并在需要时以相应方式安装其类型时,这项工作就完成了。

由索引模型根据 Issue 内容生成。

评估

技术栈
javascript, typescript
领域
developer-experience, tooling
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
38/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。