Here you have:
const obj = {
Email: "[email protected]",
ID: "106150111352875619571",
['Image URL']: "https://lh3.googleusercontent.com/a-/AOh14Gi8zfXDXbMG_kvgmIs2yYiAGbuplyapc0gyjXqpTA=s96-c",
Name: "Edward Muldrew",
}
type Obj = typeof obj
export class User implements Obj {
public ID: string;
public Name: string;
public ['Image URL']: string;
public Email: string;
constructor(
id: string,
name: string,
imageUrl: string,
email: string,
) {
this.ID = id;
this.Name = name;
this['Image URL'] = imageUrl;
this.Email = email
}
}
const foo = new User('1', 'John', 'http://example.com/data/index.png', '[email protected]')
var result = foo['Image URL'] // string
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…