Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Interfaces should extend Record<string, unknown> #43761

Closed
antoine-morvan opened this issue Apr 21, 2021 · 2 comments
Closed

Interfaces should extend Record<string, unknown> #43761

antoine-morvan opened this issue Apr 21, 2021 · 2 comments
Labels
Duplicate An existing issue was already created

Comments

@antoine-morvan
Copy link

Bug Report

🔎 Search Terms

interface type intheritance Record unkown any

🕗 Version & Regression Information

This is a behavior that I have been able to observe on 3.9.3 & 4.2.4. I also reproduced it on the different versions of the playground.

⏯ Playground Link

Playground link with relevant code

💻 Code

interface Test0 { name: string }

type Res0 = Test0 extends Record<string, unknown> ? 'yes' : 'no'  // "no"
type Res1 = Test0 extends Record<string, any> ? 'yes' : 'no'  // "yes"

type Test1 = { name: string }

type Res2 = Test1 extends Record<string, unknown> ? 'yes' : 'no'  // "yes"
type Res3 = Test1 extends Record<string, any> ? 'yes' : 'no'  // "yes"

🙁 Actual behavior

The type Res0, testing if the interface extends Record<string, unkown> is resolved to "no", whereas the its type counterpart resolves to "yes" (Res2).

🙂 Expected behavior

I believe unkown encompasses any when testing such type scructure. Thus I expect Res0 to resolve to "yes", i.e. an interface extends Record<string, unkown>.

@MartinJohns
Copy link
Contributor

Duplicate of #42825. Used search terms: interface extends record unknown

@RyanCavanaugh RyanCavanaugh added the Duplicate An existing issue was already created label Apr 21, 2021
@typescript-bot
Copy link
Collaborator

This issue has been marked as a 'Duplicate' and has seen no recent activity. It has been automatically closed for house-keeping purposes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Duplicate An existing issue was already created
Projects
None yet
Development

No branches or pull requests

4 participants