Skip to content

interface&type inference #61699

@2083335157

Description

@2083335157

πŸ”Ž Search Terms

"type", "interface", "inference", "Record<string, any[]>"

πŸ•— Version & Regression Information

  • This is the behavior in every version I tried, and I reviewed the FAQ for entries about inferface

⏯ Playground Link

https://www.typescriptlang.org/play/?ts=5.9.0-dev.20250513#code/JYOwLgpgTgZghgYwgAgILIN4ChnINYQCeAXMnCIQNoC6WAvllmIQA4oBCyAvJjvkaXJVaDJqxQAlCAGcArgBsw6HuggAPSCAAm05FIQB7KFoA80sFFABzADRkKNAHzIA-MguyUpePOkpkAPQByD5+Ymx6MgpgnDyc6po6kYbGZhbWdkJOru5QnsjecL4oQbmejMwRACoyYCZVyAkQ2rr6RqbmliC29sKOzjwYDJWSUYoAwtzINeYmqM6l0FBGQA

πŸ’» Code

interface A {
  key: any[]
}

type B = {
  key: any[]
}

type ResultA = A extends Record<string, any[]> ? true : false  // false
type ResultB = B extends Record<string, any[]> ? true : false // true

type Test<T extends Record<string, any[]>> = {}
type ResultC = Test<A> // error

πŸ™ Actual behavior

ResultA differs from ResultB in inference. Additionally, ResultC causes an error.

πŸ™‚ Expected behavior

ResultA is the same as ResultB in inference.

Additional information about the issue

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    DuplicateAn existing issue was already created

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions