microsoft / microsoft/TypeScript

Playground typing issue

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

还没有人认领这个 Issue。

Website
主要语言
Go
星标
111k
派生
14.3k
平均合并
2 天 4 小时
30 天内合并 PR
132

描述

### 🔎 Search Terms

TypeScript Playground error when attempting to import something from `@octokit/core/types`

### 🕗 Version & Regression Information

Seems irrelavent to TS version

### ⏯ Playground Link

https://www.typescriptlang.org/play/?#code/JYWwDg9gTgLgBAKjgQwM5wPIGMYQNbAwAqAnmAKboBmUEIcA5AAIQ76ED0W05HMZlBgCghoSLDgBvTGwLwAvnBp1GrXHIYBuEdwB2qeAHNCACwCuAIzgBeOLvIB3GesIAKAJTah5AB7j4egbO7MQCqF6+-nD8FMFypLG2MeQQVHDGMOYW2kA

### 💻 Code

```ts
import * as OctokitTypes from '@octokit/core/types';
```

### 🙁 Actual behavior

**Behavior 1**:

Type of the following variable is recognized as `any`:
```ts
import { Octokit } from 'octokit';
export type T = typeof Octokit;
```

**Behavior 2**:

Type of the following variable is recognized as `any`;
```ts
import * as OctokitTypes from '@octokit/core/types';
export const OctokitTypes;
```

**Behavior 3**: _Even stranger behavior_

In the following code snippet:
```ts
import * as OctokitTypes from '@octokit/core/types';
```

1. Remove any character from package name `@octokit/core/types` (e.g. `@octokit/core/type`), TS error occured, which is expected
Image
2. Re-add the removed character, TS error remained, which is very weird
Image
Apparently there is some problem with the language server, as the package name has been changed to `*/types`, but it still reports error of `*/type`

### 🙂 Expected behavior

N/A

### Additional information about the issue

_No response_

贡献指南

打开贡献指南

从这里开始

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

调研方向

首先在链接的 TypeScript Playground 中重现这三个行为,重点关注 @octokit/core/types import,以及编辑包名后仍然存在的过时诊断。跟踪相关的模块解析或 language server 行为;完成的标准是有效的 import 能够使用其实际类型得到解析,并且诊断会在编辑后更新。

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

评估

技术栈
typescript
领域
compilers
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
冷清
描述清晰度
基本清楚
新手友好度
42/100

把新 issue 发到你的邮箱

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