// Object type ******************************
type objectType = {
name: String;
city: String;
email: String;
isLoading: Boolean;
age: Number;
};
const Person: objectType = {
name: 'Saten Chauhan',
city: 'Kanpur',
email: 'saten@demo.com',
isLoading: true,
age: 35,
};
console.log(Person.name);
//Example ===================================
export type User = {
name: string;
age: number;
};
const userData: User = {
name: 'saten',
age: 50,
};
/* Interface */
export interface Person {
name: string;
age: number;
city: string;
}
const user: Person = {
name: 'saten',
age: 50,
city: 'kanpur',
};
function show(userData: User) {
return userData.name + userData.age;
}
console.log(show(user));