Skip to content

Compiler emits code that crashes when extending 'null' #2581

@DanielRosenwasser

Description

@DanielRosenwasser
function f() {
    class C extends null {
        constructor() { return Object.create(null); }
    }
    var c = new C();
    return !(c instanceof Object)
        && Function.prototype.isPrototypeOf(C)
        && Object.getPrototypeOf(C.prototype) === null;
}

console.log(f());

Expected: true
Actual:

    __.prototype = b.prototype;                    
                    ^                              
TypeError: Cannot read property 'prototype' of null

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptES6Relates to the ES6 Spec

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions