const myObject: {[key: string]: any} = {
property: 'value'
};
myObject.property2 = 'value2';
Copy
1interface User {
2 id: number;
3 name: string;
4 domain?: string;
5 age?: number;
6 isActive?: boolean;
7}
8
9let user: User = {
10 id: 1,
11 name: "infinitbility",
12};
13
14// Add element for dynamic key
15user["isActive"] = true;
16console.log("user", user);