Typescript - inlay hints for nested labeled tuples
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 45/100
- Issue 类型
- 功能
- 描述清晰度
- 基本清楚
- 活跃度
- 停滞
- 技术栈
- typescript
调研方向
从 issue 中嵌套的带标签元组示例开始,在启用所有内嵌提示的情况下在 VS Code 中复现它。将嵌套数组调用与可正常工作的 rest-parameter 调用进行比较,然后跟踪负责元组标签的 TypeScript 内嵌提示入口点。完成的标准是嵌套的 minVals 和 maxVals 标签出现在预期位置,且不会导致现有示例回归。
由索引模型根据 Issue 内容生成。
描述
Type: Feature Request
The inlay hints for an array of labeled tuples are forgotten.
Troubleshooting steps:
- Ensured Typescript is fully up-to-date.
- Enabled all inlay hints in vsCode settings.
When a type is described as tuple with labels, you can use the ...args: ThatTupleType and when calling the function, the parameters retain the labels. This is working just fine.
However, when the argument is more complex, and there are nested labeled tuples within the type, the inlay hint information is lost (although the type information is still there; TypeScript still knows that the labels are on the array).
The expectation is that if I pass an array of tuples to an argument or type that expects the tuples to adhere to rules, and the type has labels, that the inlay hints should show those nested labels in the appropriate place.
The below example will showcase the issue I'm referring to, when it's run in vsCode with all inlay hints enabled:
type ArmorValueSet = [number, number, number, number, number, number];
type ArmorValueRange = [minVals: ArmorValueSet, maxVals: ArmorValueSet];
const parseArmor = (
armorValues: ArmorValueRange[]
) => {
console.log(armorValues);
};
parseArmor([
[[6, 21, 36, 56, 81, 140], [20, 35, 55, 80, 110, 180]],
[[6, 21, 36, 56, 81, 140], [20, 35, 55, 80, 110, 180]],
[[6, 21, 36, 56, 81, 140], [20, 35, 55, 80, 110, 180]],
[[6, 21, 36, 56, 81, 140], [20, 35, 55, 80, 110, 180]],
[[6, 21, 36, 56, 81, 140], [20, 35, 55, 80, 110, 180]],
]);
const test = (...args: ArmorValueRange) => {
console.log(...args);
}
test([6, 21, 36, 56, 81, 140], [20, 35, 55, 80, 110, 180]);
On line 22, minVals and maxVals are shown correctly. However, from lines 11-15, there are no inlay hints for these tuple labels. The expectation is that each of these lines should look the same as line 22 in terms of the inlay hints that are shown.
Here is a screenshot of what my vsCode editor looks like with this code present:
VS Code version: Code 1.85.1 (0ee08df0cf4527e40edc9aa28f4b5bd38bbff2b2, 2023-12-13T09:49:37.021Z)
OS version: Windows_NT x64 10.0.19045
Modes:
- 主要语言
- Go
- 星标
- 111k
- 派生
- 14.4k
- 平均合并
- 1 天 19 小时
- 30 天内合并 PR
- 117
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
microsoft/TypeScript 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 88/100
microsoft/TypeScript#64322 · 2 条评论 · 1 个 reaction · 已指派 2 人 ·
-
Possible Improvement
难度 2/5 1-3 小时 新手友好度 78/100
microsoft/TypeScript#64278 · 1 条评论 · 1 个 reaction ·
-
Docs
难度 2/5 1-3 小时 新手友好度 70/100
microsoft/TypeScript#64118 · 1 条评论 ·
-
难度 1/5 1 小时以内 新手友好度 88/100
microsoft/TypeScript#64094 ·
-
Docs
难度 2/5 1-3 小时 新手友好度 76/100
microsoft/TypeScript#63959 · 5 条评论 ·
查看 microsoft/TypeScript 的全部 Issue
相似的 Issue
-
kind/bug
难度 2/5 1-3 小时 新手友好度 88/100
kubernetes-sigs/prow#953 · 1 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
caddyserver/caddy#8046 ·
-
难度 2/5 1-3 小时 新手友好度 86/100
-
L1 recommended for recruits
难度 2/5 1-3 小时 新手友好度 88/100
-
area/entangle bug
难度 1/5 1 小时以内 新手友好度 92/100