| ID | ValI | fTime |
|----|---------|---------------------|
| 2 | 0 | 2015-05-09 12:56:39 |
| 3 | 0 | 2015-05-09 12:56:39 |
| 2 | 4 | 2015-05-09 01:48:30 |
| 3 | 6 | 2015-05-09 01:48:30 |
| 2 | 2 | 2015-05-09 03:01:09 |
| 3 | 4 | 2015-05-09 03:01:09 |
我发现在示例一中,//
// EXAMPLE ONE -- GENERIC DOESN'T WORK
//
interface Car {
fuel: number
}
function handleCar<GenericCar extends Car = Car>(car: GenericCar) {
return {...car} // ERROR
}
//
// EXAMPLE TWO -- WORKS FINE WITHOUT GENERIC
//
interface Car2 {
fuel: number
}
function handleCar2(car: Car2) {
return {...car}
}
会出现以下打字稿错误:{...car}
是什么给出的?在此期间,我正在使用error TS2698: Spread types may only be created from object types.