All files userInfoExtension.ts

100% Statements 38/38
100% Branches 1/1
100% Functions 1/1
100% Lines 38/38

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 381x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x
interface BasicUserInfo {
    name: string;
    age: number;
}
 
interface AddressInfo {
    street: string;
    city: string;
}
 
/**
 * 任務:請實作一個 interface 或 type,藉此來建立 `FullUserInfo`,將 `BasicUserInfo` 和 `AddressInfo` 兩個介面的資訊合併。
 *
 * 範例:
 * FullUserInfo 應該包含以下屬性:
 * name: string;
 * age: number;
 * street: string;
 * city: string;
 */
 
// 請在此處寫下你的程式碼
type FullUserInfo = BasicUserInfo & AddressInfo;
 
/**
 * 任務:實作一個函式 `createFullUserInfo`,將使用者的基本資訊和地址資訊合併成一個物件。
 *
 * 範例:
 * createFullUserInfo({ name: 'John', age: 30, street: 'Main St', city: 'Metropolis' }) 
 * 應該回傳 { name: 'John', age: 30, street: 'Main St', city: 'Metropolis' }
 *
 * @param user - 一個物件,包含使用者的基本資訊和地址資訊
 * @returns - 回傳一個物件,表示合併後的使用者資訊
 */
export function createFullUserInfo(user: FullUserInfo): FullUserInfo {
    // 請在此處寫下你的程式碼
    return user;
}