Skip to content

with infer in template string, suggestion works in 4.6, but not work in 4.7 #49680

Description

@xxleyi

Bug Report

🔎 Search Terms

suggestion pathof

🕗 Version & Regression Information

4.7

⏯ Playground Link

Playground link with relevant code

💻 Code

// get from https://github.com/microsoft/TypeScript/issues/20423#issuecomment-812564842typePathOf<T,Kextendsstring,Pextendsstring="">=Kextends `${infer U}.${infer V}`
? UextendskeyofT ? PathOf<T[U],V, `${P}${U}.`> : `${P}${keyofT&(string|number)}`
: KextendskeyofT ? `${P}${K}` : `${P}${keyofT&(string|number)}`;declarefunctionconsumer<Kextendsstring>(path: PathOf<{a: string,b: {c: string}},K>) : number;// suggestion works well in 4.6, and not work in 4.7consumer('b.')

🙁 Actual behavior

image

🙂 Expected behavior

image

Metadata

Metadata

Labels

Fix AvailableA PR has been opened for this issueNeeds InvestigationThis issue needs a team member to investigate its status.RescheduledThis issue was previously scheduled to an earlier milestone

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions