TypeError: x is not a function
Locate the failed assumption, reproduce it, then repair the cause.
What actually caused it
The name x resolved to a value, but that value cannot be called. Parentheses request a call; a string, , number, or value does not become callable because its variable name sounds like an action.
Common causes include a misspelled , a wrong import shape, assigning a 's result where a was needed, or shadowing a callable name with a local variable. Inspect typeof x immediately before the failing call and trace where that value was assigned.
This differs from “x is not defined”: here the or access was resolved, but its value is wrong for a call.
Minimal reproduction
A result stored instead of a callback
function createLabel() { return "Ready"; }
const x = createLabel();
x();A shadowed callable name
const x = "not callable";
x();The fix
Restore the intended at the assignment or import boundary. For optional , check typeof value === "function" before invoking them and decide explicitly what to do when no callback is present.
A typeof guard prevents the immediate crash but should not silently excuse a required dependency with the wrong type. When the is required, throw or report a clear configuration error and repair its source.
Keep the function value
function createLabel() { return "Ready"; }
const x = createLabel;
if (typeof x === "function") {
console.log(x());
}