Skip to main content

Function: tokenToString()

tokenToString(token): string

Produces a detailed string representation of a DI token or provider definition.

  • Class constructors → their name.
  • Symbols → symbol.toString().
  • Provider objects:
    • If it has a provide key, recurses on that token.
    • If it has useClass, shows [useClass: ClassName].
    • If it has useValue, shows [useValue: <type>].
  • Fallback → String(token).

Parameters

token

unknown

The injection token or provider object to stringify.

Returns

string

A descriptive string for debugging or error output.