class Car{}class Seller { cars: Car[] = [] sell() { if (this.cars.length === 0) { throw "No cars for sale" } //具体实现…… } }var seller = new Seller()seller.sell()