microsoft / microsoft/TypeScript

Broken autoimport of module without index reexport

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

还没有人认领这个 Issue。

Domain: LS: Auto-import Experience Enhancement Suggestion
主要语言
Go
星标
111k
派生
14.3k
平均合并
2 天 4 小时
30 天内合并 PR
132

描述

Demo: https://github.com/zerkalica/ts-references-autoimport-bug/tree/no-autoimport-wo-index

TypeScript Version: 4.0.2
VSCode Version: 1.49.2
OS: Ubuntu 20.04.1 LTS

Example 1

Package 'b' depends on 'a', but 'a' has no index.ts and types in package.json.

Steps to reproduce

  1. clone, switch to no-autoimport-wo-index, yarn install
  2. Open lib/b/b.ts in vscode, type someA
  3. Expected: autoimport suggest import { someA } from '@some/lib-a/a', actual: no autoimport

Example 2

Package 'd' depends only on 'c', 'c' depends on 'a', but 'a' has no index.ts and types in package.json.

Steps to reproduce

  1. clone, switch to no-autoimport-wo-index, yarn install
  2. Open lib/d/d.ts in vscode, type someA
  3. Expected: no someA in autoimport, actual: autoimport suggests broken import { someA } from '../a/a'

贡献指南

打开贡献指南

从这里开始

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

调研方向

克隆链接的 no-autoimport-wo-index 分支,运行 yarn install,并在 lib/b/b.ts 和 lib/d/d.ts 中重现这两种情况。比较实际的和预期的 autoimport 建议,包括 package.json 类型声明;当 Example 1 建议 @some/lib-a/a,而 Example 2 不建议损坏的相对导入时,即可认为该 issue 已完成。

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

评估

技术栈
typescript, vscode
领域
developer-experience, tooling
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
描述清楚
新手友好度
45/100

把新 issue 发到你的邮箱

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