typeof const FRUITS = {
apple: 'Apple',
orange: 'Orange',
banana: 'Banana'
} type Fruits = typeof FRUITStype Fruits = {
apple: string;
orange: string;
banana: string;
}const FRUITS = {
apple: 'Apple',
orange: 'Orange',
banana: 'Banana'
} as consttype Fruits = typeof FRUITStype Fruits = {
readonly apple: "Apple";
readonly orange: "Orange";
readonly banana: "Banana";
}type FruitKey = keyof typeof FRUITStype FruitKey = "apple" | "orange" | "banana"type FruitValue = typeof FRUITS[keyof typeof FRUITS]type FruitValue = "Apple" | "Orange" | "Banana"type FavoriteFruit = Pick<Fruits, "apple" | "orange">type FavoriteFruit = {
readonly apple: "Apple";
readonly orange: "Orange";
}type ExcludedFavoriteFruit = Omit<Fruits, "apple" | "orange">type ExcludedFavoriteFruit = {
readonly banana: "Banana";
}&
type Apple = {
apple: 'Apple'
}
type Orange = {
orange: 'Orange'
}
type Banana = {
banana: 'Banana'
} type Fruits = Apple & Orange & Bananaconst obj: Fruits = {
apple: 'Apple',
orange: 'Orange',
}
Type '{ apple: "Apple"; orange: "Orange"; }' is not assignable to type 'Fruits'.
Property 'banana' is missing in type '{ apple: "Apple"; orange: "Orange"; }' but required in type 'Banana'.(2322)