Skip to content

noUnusedLocals with allowJS and checkJS causes error #21533

Closed
@natedanner

Description

@natedanner

TypeScript Version: 2.7.1

Search Terms:
checkJS, unusedlocals, tsc.js:59841

Code

Run: tsc test.js --noUnusedLocals --checkJS --allowJS --noEmit
With

class MyClass {

	doSomething() {
	};
}

Expected behavior:
No errors introduced

Actual behavior:
/usr/local/lib/node_modules/typescript/lib/tsc.js:59841
throw e;
^

Error: Debug Failure.
at checkUnusedClassMembers (/usr/local/lib/node_modules/typescript/lib/tsc.js:35757:38)
at checkUnusedIdentifiers (/usr/local/lib/node_modules/typescript/lib/tsc.js:35643:29)
at checkSourceFileWorker (/usr/local/lib/node_modules/typescript/lib/tsc.js:37913:21)
at checkSourceFile (/usr/local/lib/node_modules/typescript/lib/tsc.js:37891:13)
at getDiagnosticsWorker (/usr/local/lib/node_modules/typescript/lib/tsc.js:37945:17)
at Object.getDiagnostics (/usr/local/lib/node_modules/typescript/lib/tsc.js:37934:24)
at /usr/local/lib/node_modules/typescript/lib/tsc.js:59858:85
at runWithCancellationToken (/usr/local/lib/node_modules/typescript/lib/tsc.js:59834:24)
at getSemanticDiagnosticsForFileNoCache (/usr/local/lib/node_modules/typescript/lib/tsc.js:59848:20)
at getAndCacheDiagnostics (/usr/local/lib/node_modules/typescript/lib/tsc.js:60059:26)

Additional info:
If I remove the semi-colon from the doSomething method or don't pass the --noUnusedLocals flag the error does not appear. I don't get the error in either case on TypeScript version 2.6.2. We are using allowJS/checkJS feature on our legacy JS at my shop and ran into this bug after 2.7.1 upgrade

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions