Skip to content

Cannot read property 'heritageClauses' of undefined #10268

Closed
@mhevery

Description

@mhevery

TypeScript Version: 1.8.0 / nightly (2.0.0-dev.201xxxxx)
Version 1.9.0-dev.20160409

Code

type.ts:

export var Type = Function;

export interface Type<T> extends Function { new (...args: any[]): T; }
import {Type} from './type';

interface TypeProvider extends Type<any>
;

It provides a correct error here:
https://www.typescriptlang.org/play/#src=export%20var%20Type%20%3D%20Function%3B%0D%0A%0D%0Aexport%20interface%20Type%3CT%3E%20extends%20Function%20%7B%20new%20(...args%3A%20any%5B%5D)%3A%20T%3B%20%7D%0D%0A%0D%0Ainterface%20TypeProvider%20extends%20Type%3Cany%3E%0D%0A%3B%0D%0A

Expected behavior:

a reasonable error

Actual behavior:

TypeError: Cannot read property 'heritageClauses' of undefined
    at Object.getClassExtendsHeritageClauseElement (/Users/misko/work/angular/node_modules/typescript/lib/typescript.js:6149:52)
    at getBaseTypeNodeOfClass (/Users/misko/work/angular/node_modules/typescript/lib/typescript.js:17884:23)
    at getBaseConstructorTypeOfClass (/Users/misko/work/angular/node_modules/typescript/lib/typescript.js:17905:36)
    at resolveBaseTypesOfClass (/Users/misko/work/angular/node_modules/typescript/lib/typescript.js:17948:39)
    at Object.writeBaseConstructorTypeOfClass (/Users/misko/work/angular/node_modules/typescript/lib/typescript.js:30259:13)
    at emitTypeOfTypeReference (/Users/misko/work/angular/node_modules/typescript/lib/typescript.js:32596:30)
    at emitSeparatedList (/Users/misko/work/angular/node_modules/typescript/lib/typescript.js:31999:21)
    at emitCommaList (/Users/misko/work/angular/node_modules/typescript/lib/typescript.js:32004:13)
    at emitHeritageClause (/Users/misko/work/angular/node_modules/typescript/lib/typescript.js:32585:17)
    at writeInterfaceDeclaration (/Users/misko/work/angular/node_modules/typescript/lib/typescript.js:32662:13)
Compilation failed

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugA bug in TypeScriptNeeds More InfoThe issue still hasn't been fully clarified

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions