TypeScript Version: 2.2.1
Code
classPerson{firstName: string;lastName: string;getfullName?(){returnthis.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.
TypeScript Version: 2.2.1
Code
Expected behavior:
Since
fullNameis optional the following should work: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.