Skip to content

TS9201: Invalid Macro Argument Count

Category: Macro Syntax
Severity: Error

Message

'{macro}' expects {expected} argument(s), got {actual}

Explanation

This macro was called with the wrong number of arguments. Each macro has a specific signature that must be followed.

Common Examples

summon() - Too few/many type arguments

typescript
// Error: summon() expects 1 type argument
summon(); // TS9201
summon<Eq, Ord>(); // TS9201

// Correct:
summon<Eq<number>>();

comptime() - Missing callback

typescript
// Error: comptime() expects 1 argument
const x = comptime(); // TS9201

// Correct:
const x = comptime(() => 1 + 2);

@derive() - Empty arguments

typescript
// Error: @derive() expects at least 1 argument
@derive() // TS9201
class Point {}

// Correct:
@derive(Eq, Clone, Debug)
class Point {}

How to Fix

  1. Check the macro documentation for the correct signature
  2. Ensure all required arguments are provided
  3. Remove any extra arguments

Macro Signatures Quick Reference

MacroSignature
summonsummon<TC<T>>()
comptimecomptime(() => expr)
@derive@derive(TC1, TC2, ...)
@instance@instance (no args)
implicit= implicit() (no args)
specializespecialize(fn)
pipepipe(value, fn1, fn2, ...)

See Also

Released under the MIT License.