You cannot cast from a custom to a primitive without erasing the type first. unknown erases the type checking.
Try :
myRating as unknown as number
Or :
myRating as any
Also, remove | number from your declaration.
You cannot cast from a custom to a primitive without erasing the type first. unknown erases the type checking.
Try :
myRating as unknown as number
Or :
myRating as any
Also, remove | number from your declaration.