All files vehicleInterface.ts

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

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 261x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 2x 2x 2x 1x 1x
/**
 * 車輛介面已被移除,你需要自己定義一個新的車輛介面。
 * 車輛介面應該包含 brand、model 和 year 三個屬性,分別為字串型別和數字型別。
 */
 
/**
 * 獲取車輛的詳細資訊
 * @param vehicle - 車輛物件,應該包含 brand、model 和 year 三個屬性
 * 
 * 範例:
 * 輸入: { brand: 'Toyota', model: 'Corolla', year: 2020 }
 * 輸出: 'Toyota Corolla (2020)'
 */
 
type VehicleType = {
    brand: string;
    model: string;
    year: number;
}
 
export function vehicleInfo(vehicle: VehicleType): string {
    // 在此實現函式
    return `${vehicle.brand} ${vehicle.model} (${vehicle.year})`;
}
 
vehicleInfo({ brand: 'Toyota', model: 'Corolla', year: 2020 });