A built-in namespace object such as Math or JSON is called like a function, which throws
What it finds
Math(), new JSON(), Reflect(target): Math, JSON, Reflect, Atomics and Intl are plain objects that group functions, not functions themselves, so calling one or using it with new throws a TypeError. A member such as Math.max was meant.
The names must refer to the global objects, not to something the file declares.
From the rule's source, namespace_object_call.rs.
function compute(values: number[]) { const top = Math(values);tx0 reports: Math is an object of functions and cannot be called const data = new JSON();tx0 reports: JSON is an object of functions and cannot be used with new return [top, data, Math.max(...values)];} Turn it on, off or suppress it
The rule runs in every tier. To turn it off for a project, set its level in tx0.toml:
[rules]
"tx0/ts:namespace-object-call" = "off"To keep one finding, suppress it with a reason. tx0 suppress ID --reason "..." writes the comment on the line before the code:
// tx0: ignore[tx0/ts:namespace-object-call] reason="..."tx0 explain tx0/ts:namespace-object-call shows the same in the terminal. Found a false positive? Report it.