-
Notifications
You must be signed in to change notification settings - Fork 12.9k
Open
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript
Milestone
Description
TypeScript Version: 2.2.1
Code
class Person {
firstName: string;
lastName: string;
get fullName?() {
return this.firstName + ' ' + this.lastName;
}
}
Expected behavior:
Since fullName
is optional the following should work:
const Me: Person = {
firstName: 'Foo',
lastName: 'Bar'
}
Actual behavior:
A syntax error occurs on this line get fullName?() {
I'm not sure if omitting the ability to optionalize getters was by design or not. If it was by design, I'd love to know the reasoning behind it.
drewjex, bradenhs, MeirMalka, iwebd, bwiercinski and 50 more
Metadata
Metadata
Assignees
Labels
In DiscussionNot yet reached consensusNot yet reached consensusSuggestionAn idea for TypeScriptAn idea for TypeScript