0
votes

The transpiller complains of:

The left-hand side of an arithmetic operation must be of type 'any', 'number' or an enum type.

about this code:

import { map } from  'rxjs/operators';

const multiply = num => map(value => value * num);

How can I fix it ?

1

1 Answers

0
votes

Since you don't specify the type of value, no inference is made for the T type parameter of map, so T gets set to {}, which ends up propagating back to value and causing the error. You can fix this by specifying the type of value:

const multiply = num => map((value: number) => value * num);

(You should probably specify the type of num too, but that's unrelated to the question.)