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

Unhelpful error message when interface ... extends number #46246

Open
Mr-Andersen opened this issue Oct 6, 2021 Β· 4 comments Β· May be fixed by #46357
Open

Unhelpful error message when interface ... extends number #46246

Mr-Andersen opened this issue Oct 6, 2021 Β· 4 comments Β· May be fixed by #46357
Labels
Bug Domain: Error Messages Good First Issue Help Wanted

Comments

@Mr-Andersen
Copy link

@Mr-Andersen Mr-Andersen commented Oct 6, 2021 β€’

Bug Report

πŸ”Ž Search Terms

interface extends only refers to a type

πŸ•— Version & Regression Information

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

⏯ Playground Link

Playground link with relevant code

πŸ’» Code

export interface MessageId extends number {}

πŸ™ Actual behavior

error TS2693: 'number' only refers to a type, but is being used as a value here.

πŸ™‚ Expected behavior

Informative error about why an interface cannot extend number (or string -- the error is the same besides the type name)

@DanielRosenwasser DanielRosenwasser added Bug Good First Issue Help Wanted Domain: Error Messages labels Oct 6, 2021
@younes-io
Copy link

@younes-io younes-io commented Oct 10, 2021

I would think of a message like: an interface cannot extend a primitive type like 'number'; an interface can only extend named types and classes

What do you think?

@PurityLake
Copy link

@PurityLake PurityLake commented Oct 11, 2021

Is this issue being worked on? I would like to look into this as a first issue.

@HarsheetKakar
Copy link

@HarsheetKakar HarsheetKakar commented Oct 11, 2021

I was actually working on it, sorry I forgot to mention that earlier

@HarsheetKakar HarsheetKakar linked a pull request that will close this issue Oct 14, 2021
@charan1998
Copy link

@charan1998 charan1998 commented Jan 22, 2022

Anyone working on this? Or can I take this up?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Domain: Error Messages Good First Issue Help Wanted
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants