microsoft / microsoft/TypeScript
Completion does not work for generic type extending tuple or array of all partial type
还没有人认领这个 Issue。
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.3k
- 平均合并
- 2 天 4 小时
- 30 天内合并 PR
- 132
描述
### Extension Version
0.20251202.1
### VS Code Version
1.103.2
### Operating system Version
Linux Mint 22.2 Zara
### Steps to reproduce
1. Paste the following code into VS Code.
2. In each example, type com... and check whether it is auto-completed.
### Issue
```ts
// All partial type works
type AllPartialObject = {
component?: string
}
declare function extendTheme1(
extensions: Extensions
): void
extendTheme1([
{
/* Can autocomplete `component` here */
},
])
// But all partial type with mapped types doesn't work
declare function extendTheme2<
Extensions extends [AllPartialObject & Record],
>(extensions: Extensions): void
extendTheme2([
{
/* Can't autocomplete `component` here */
},
])
// with required field works
type PartialWithRequiredObject = {
component?: string
requiredField: string
}
declare function extendTheme3<
Extensions extends [PartialWithRequiredObject & Record],
>(extensions: Extensions): void
extendTheme3([
{
/* Can autocomplete `component` here */
},
])
// but with required field and complete required field doesn't work
extendTheme3([
{
requiredField: 'foo',
/* Can't autocomplete `component` here */
},
])
// also BaseTheme with no mapped types doesn't work too
declare function extendTheme4(
extensions: Extensions
): Extensions
extendTheme4([
{
requiredField: 'foo',
/* Can't autocomplete `component` here */
},
])
// no extend tuple works
declare function extendTheme5<
Extensions extends AllPartialObject & Record,
>(extensions: [Extensions]): Extensions
extendTheme5([
{
/* Can autocomplete `component` here */
},
])
```
Original issue: https://github.com/microsoft/TypeScript/issues/45617
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
首先,使用 issue 中的 TypeScript 示例,在 VS Code 中复现 extendTheme1 到 extendTheme5 之间的补全差异,然后将其行为与链接的原始 issue 进行比较。当组件补全出现在当前失败的泛型元组和映射类型场景中,且不会导致正常工作的示例出现回归时,即视为完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- typescript, vscode
- 领域
- compilers, developer-experience
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 38/100