Skip to content

Commit b435bef

Browse files
committed
fixed ts errors
1 parent 5736d74 commit b435bef

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

cli-socks/src/components/Product.vue

+7-2
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ import ProductReview from './ProductReview.vue';
6767
6868
export default class Product extends Vue {
6969
@Prop({default: false}) private premium!: boolean;
70-
@Prop() private cartLength: number;
70+
@Prop() private cartLength!: number;
7171
7272
product = {
7373
name: "Vue Socks",
@@ -91,7 +91,12 @@ export default class Product extends Vue {
9191
if (!this.product.reviews.length) {
9292
return null;
9393
}
94-
return Math.round(this.product.reviews.map(x => x.rating).reduce((a, c) => a + c, 0) / this.product.reviews.length);
94+
const reviews = this.product.reviews as any;
95+
const totalStars = reviews
96+
.map((x: any) => x.rating)
97+
.reduce((a: any, c: any) => a + c, 0);
98+
99+
return Math.round(totalStars / this.product.reviews.length);
95100
}
96101
97102
get title() {

0 commit comments

Comments
 (0)