Skip to content

Crash: TypeError: Cannot read properties of undefined (reading 'kind') in checkPropertyAccessibility when using abstract in Class Expression #62920

@na7ure-a

Description

@na7ure-a

🔎 Search Terms

"Cannot read properties of undefined (reading 'kind')"

"isMemberName crash"

"abstract property class expression crash"

"checkPropertyAccessibilityAtLocation crash"

🕗 Version & Regression Information

Versions tested: 5.7.3, 5.8.3, 5.9.3, Nightly ([email protected])

Is this a regression? No, this appears to be a long-standing issue in the checker's handling of illegal abstract modifiers within class expressions.

Does it occur in nightly? Yes.

⏯ Playground Link

https://www.typescriptlang.org/zh/play/?target=7&outFile=mylib.js&ts=5.8.3#code/DYUwLgBAYg9jEF4IGNgEMDOGIG8BQEhKMAdhmAE4CuyYMFAFAJS4FHtgAWAlhgHQAjNBQDUIgNxtCAXykQ0A8hTS0IQipOmS8QA

💻 Code

let Foo = class {
    constructor() {
        this.bar++;
    }
    abstract bar;
};

🙁 Actual behavior

.\ts-versions\5.9.3\node_modules\.bin\tsc.cmd --noEmit  .\bugfind\mute1.ts
D:\do\tscFuzz\ts-versions\5.9.3\node_modules\typescript\lib\_tsc.js:123168
      throw e;
      ^

TypeError: Cannot read properties of undefined (reading 'kind')
    at isMemberName (D:\do\tscFuzz\ts-versions\5.9.3\node_modules\typescript\lib\_tsc.js:11830:15)                                                                                                       
    at getTextOfIdentifierOrLiteral (D:\do\tscFuzz\ts-versions\5.9.3\node_modules\typescript\lib\_tsc.js:15842:10)                                                                                       
    at checkPropertyAccessibilityAtLocation (D:\do\tscFuzz\ts-versions\5.9.3\node_modules\typescript\lib\_tsc.js:74766:132)                                                                              
    at checkPropertyAccessibility (D:\do\tscFuzz\ts-versions\5.9.3\node_modules\typescript\lib\_tsc.js:74735:12)                                                                                         
    at checkPropertyAccessExpressionOrQualifiedName (D:\do\tscFuzz\ts-versions\5.9.3\node_modules\typescript\lib\_tsc.js:75176:7)                                                                        
    at checkPropertyAccessExpression (D:\do\tscFuzz\ts-versions\5.9.3\node_modules\typescript\lib\_tsc.js:74932:94)                                                                                      
    at checkExpressionWorker (D:\do\tscFuzz\ts-versions\5.9.3\node_modules\typescript\lib\_tsc.js:80937:16)                                                                                              
    at checkExpression (D:\do\tscFuzz\ts-versions\5.9.3\node_modules\typescript\lib\_tsc.js:80846:32)                                                                                                    
    at checkPostfixUnaryExpression (D:\do\tscFuzz\ts-versions\5.9.3\node_modules\typescript\lib\_tsc.js:79348:25)                                                                                        
    at checkExpressionWorker (D:\do\tscFuzz\ts-versions\5.9.3\node_modules\typescript\lib\_tsc.js:80980:16)  

🙂 Expected behavior

The compiler should not crash

Additional information about the issue

No response

Metadata

Metadata

Assignees

Labels

BugA bug in TypeScriptCrashFor flagging bugs which are compiler or service crashes or unclean exits, rather than bad output

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions