-
Notifications
You must be signed in to change notification settings - Fork 13k
Closed
Labels
BugA bug in TypeScriptA bug in TypeScriptEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Help WantedYou can do thisYou can do this
Milestone
Description
TypeScript Version: 2.1.1 / nightly (2.2.0-dev.201xxxxx)
Version 2.1.6
Code
class PhoneBook {
private sally: number = 123; // error TS6133: 'sally' is declared but never used.
private sam: number =456; // error TS6133: 'sam' is declared but never used.
getNumber(who: 'sally' | 'wendy'): number {
return this[who]; // tsc is able to correctly deduce that this is a number
}
}
const phoneBook = new PhoneBook();
console.log(phoneBook.getNumber('sally'));
Expected behavior:
Using a private member via []
notation should not trigger --noUnusedLocals
errors.
Actual behavior:
A private member used only via []
triggers --noUnusedLocals
errors.
kemsky and Dervol03
Metadata
Metadata
Assignees
Labels
BugA bug in TypeScriptA bug in TypeScriptEffort: ModerateRequires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Requires experience with the TypeScript codebase, but feasible. Harder than "Effort: Casual".Help WantedYou can do thisYou can do this