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

create an instance from class extends null is allowed but it should not #25187

Closed
Kingwl opened this issue Jun 25, 2018 · 3 comments
Closed

create an instance from class extends null is allowed but it should not #25187

Kingwl opened this issue Jun 25, 2018 · 3 comments
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug

Comments

@Kingwl
Copy link
Contributor

Kingwl commented Jun 25, 2018

TypeScript Version: 3.0.0-dev.201xxxxx

Search Terms:

Code

class A extends null { }

new A()

Expected behavior:

Uncaught TypeError: Super constructor null of A is not a constructor

Actual behavior:

everything is ok

Playground Link:

https://www.typescriptlang.org/play/index.html#src=class%20A%20extends%20null%20%7B%20%7D

Related Issues:

@ghost ghost added the Suggestion An idea for TypeScript label Jun 25, 2018
@mhegazy
Copy link
Contributor

mhegazy commented Jun 25, 2018

This looks like a bug in the runtime. An ES2015 class can extend null.

See spec definiton of evaluating null heritage clauses: https://www.ecma-international.org/ecma-262/6.0/#sec-runtime-semantics-classdefinitionevaluation
And MDN docs: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes/extends#Extending_null

@mhegazy mhegazy added Working as Intended The behavior described is the intended behavior; this is not a bug and removed Suggestion An idea for TypeScript labels Jun 25, 2018
@Kingwl
Copy link
Contributor Author

Kingwl commented Jun 26, 2018

tc39/ecma262#1036

@typescript-bot
Copy link
Collaborator

Automatically closing this issue for housekeeping purposes. The issue labels indicate that it is unactionable at the moment or has already been addressed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Working as Intended The behavior described is the intended behavior; this is not a bug
Projects
None yet
Development

No branches or pull requests

3 participants