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

tsc TypeError: Cannot read property 'flags' of undefined #16861

Closed
koloboid opened this issue Jun 30, 2017 · 1 comment · Fixed by #20179
Closed

tsc TypeError: Cannot read property 'flags' of undefined #16861

koloboid opened this issue Jun 30, 2017 · 1 comment · Fixed by #20179
Assignees
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue

Comments

@koloboid
Copy link

TypeScript Version: 2.4.1

Code

// This is minimal chunk of code
class BaseType<T> {
    bar: T
}

class NextType<C extends { someProp: any }, T = C['someProp']> extends BaseType<T> {
}

class Foo extends NextType<Foo> {
    someProp: {
        test: true
    }
}

const foo = new Foo();
foo.bar.test

Expected behavior:
Just to compile and run. May be this code violates TypeScript rules, but the actual result is unexpected, anyway
Both atom-typescript and WebStorm EAP consider this code as valid, and even correctly auto-complete "foo.bar.test"

Actual behavior:

$ tsc
/usr/lib/node_modules/typescript/lib/tsc.js:55776
                throw e;
                ^

TypeError: Cannot read property 'flags' of undefined
    at Object.getCheckFlags (/usr/lib/node_modules/typescript/lib/tsc.js:7996:22)
    at getTargetSymbol (/usr/lib/node_modules/typescript/lib/tsc.js:37957:23)
    at checkKindsOfPropertyMemberOverrides (/usr/lib/node_modules/typescript/lib/tsc.js:37975:31)
    at checkClassLikeDeclaration (/usr/lib/node_modules/typescript/lib/tsc.js:37915:21)
    at checkClassDeclaration (/usr/lib/node_modules/typescript/lib/tsc.js:37858:13)
    at checkSourceElement (/usr/lib/node_modules/typescript/lib/tsc.js:38767:28)
    at Object.forEach (/usr/lib/node_modules/typescript/lib/tsc.js:298:30)
    at checkSourceFileWorker (/usr/lib/node_modules/typescript/lib/tsc.js:38836:20)
    at checkSourceFile (/usr/lib/node_modules/typescript/lib/tsc.js:38821:13)
    at getDiagnosticsWorker (/usr/lib/node_modules/typescript/lib/tsc.js:38874:17)
@koloboid
Copy link
Author

Thank you guys, works like a charm in 2.7.0-dev.20171224

@mhegazy mhegazy added the Fixed A PR has been merged for this issue label Jan 11, 2018
@microsoft microsoft locked and limited conversation to collaborators Jul 3, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Bug A bug in TypeScript Fixed A PR has been merged for this issue
Projects
None yet
4 participants