I am creating a model class in typescript:
class User {
private 'google.com': string;
private surname: string;
private age: number;
constructor(name: string, surname: string, age: number) {
this['google.com'] = name;
this.surname = surname;
this.age = age;
}
}
But instead of doing it that way, I am using shorthand (more info):
class User {
constructor(
private 'google.com': string, // Error: Identifier Expected. ts(1003)
private surname: string,
private age: number
) {}
}
How do I escape the special character in 'google.com' in the shorthand method to eliminate the error?