Skip to content

generic inferred from keyof has value of implicit any when noImplicitAny is trueΒ #46107

@DetachHead

Description

@DetachHead

Bug Report

πŸ”Ž Search Terms

keyof generic noImplicitAny

πŸ•— Version & Regression Information

4.5.0-dev.20210927

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

declare function foo<T>(value: keyof T): T

const bar = foo('asdf') //type is { asdf: any }

πŸ™ Actual behavior

type is inferred as { asdf: any }

πŸ™‚ Expected behavior

type is inferred as { asdf: unknown }, or a noImplicitAny error occurs

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions