How to fix "OperationError: Operation on an invalid type" when running WebCompiler

364 Views Asked by At

Changing computers forced me to install VS2022 and the WebCompiler 2022+ extension. When running my compiler, the following error is generated: OperationError: Operation on an invalid type in ......./file.less. The line in question has the following calculation: padding-left: 20px + @default-padding / 2; where the @default-padding variable has a value of 10px.

With the previous installed WebCompiler, I did not have this issue that the compiler is raising now. How do I address this please?

2

There are 2 best solutions below

0
Sand On

Using this answer as a reference, can the --math=strict flag help?

0
Carlos Lopez On

Taking @Sand answer as basis. You can go to compilerconfig.json.defaults and modify

  "strictMath": true,

And voila!!!

Here the configuration reference: https://lesscss.org/usage/#less-options-math

Hope this helps!