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
- Check the macro documentation for the correct signature
- Ensure all required arguments are provided
- Remove any extra arguments
Macro Signatures Quick Reference
| Macro | Signature |
|---|---|
summon | summon<TC<T>>() |
comptime | comptime(() => expr) |
@derive | @derive(TC1, TC2, ...) |
@instance | @instance (no args) |
implicit | = implicit() (no args) |
specialize | specialize(fn) |
pipe | pipe(value, fn1, fn2, ...) |
See Also
- TS9202 - Invalid macro argument type
- Macro Reference
