Why when I try to define object method:
export class Helper {
function add(x: number, y: number): number {
return x + y;
}
}
I get following error:
Unexpected token. A constructor, method, accessor, or property was expected.
I followed example from this site: https://www.typescriptlang.org/docs/handbook/functions.html
But when I remove function keyword it works, but that contradicts the official source.