Type 'T & Function' has no call signatures
07:03 10 Mar 2026

I would like to have a function that either call obj with item as param if obj is a function else juste return the object.

I've done it like this:

export function getValue(
  obj: T | ((item: any) => T),
  item: any
): T {
  return typeof obj === "function" ? obj(item) : obj;
}

But I get the issue:

This expression is not callable.
  Not all constituents of type '((item: any) => T) | (T & Function)' are callable.
    Type 'T & Function' has no call signatures.ts(2349)

Because there are some cases like:

class Foo {};

typeof Foo; // 'function'

How could I make this work without using as ?

typescript