Microsoft/TypeScript

Missing IntelliSense suggestions in a partial mapped generic argument

Open

#47,518 创建于 2022年1月19日

在 GitHub 查看
 (1 评论) (1 反应) (0 负责人)TypeScript (6,726 fork)batch import
Domain: LS: Completion ListsExperience EnhancementHelp WantedSuggestion

仓库指标

Star
 (48,455 star)
PR 合并指标
 (平均合并 6天 17小时) (30 天内合并 9 个 PR)

描述

Bug Report

The issue I'm facing is missing IntelliSense suggestions inside the inline object argument of a function which accepts a generic extending the partial of a mapped type. (Wow, that sentence was a doozy, no worries code sample below)

🔎 Search Terms

IntelliSense, Generic, Partial, Optional , Mapped, Function, Parameter, Argument, Object

🕗 Version & Regression Information

I'm using 4.5.4 Seems to be working in 4.3.5 on the playground.

⏯ Playground Link

Playground link with relevant code

💻 Code

type Original = {
    prop1: true,
    prop2: string
}

type Mapped = {[Prop in keyof Original as `get${Capitalize<string & Prop>}`]: Original[Prop]};

declare function foo<T extends Partial<Mapped>>(options: T): void;

foo({
/* cursor */
});

🙁 Actual behavior

  1. No (relevant) suggestion on CTRL + SPACE
  2. Suggestion on typing correct prefix ("get") of either parameter
  3. After setting said parameter correctly neither CTRL + SPACE nor typing gives another suggestion

🙂 Expected behavior

CTRL + SPACE (hopefully) would always give suggestion for allowed/fitting/legal properties

贡献者指南