TS2314
Generic type needs type arguments
Generic type 'Box' requires 1 type argument(s).The compiler’s own words. Not translated — this is the string you pasted into a search box.
A generic alias was used without supplying the type parameter it requires.
Reproduction
type Box<T> = { value: T } const box: Box = { value: 1 }
The build asserts this emits exactly this code.
Why the compiler says this
`T` is an input to the type-level function `Box`. Without an argument or a declared default, the checker cannot know which value type the property should contain.
Fixes
- 01
type Box<T> = { value: T } const box: Box<number> = { value: 1 }
Supply the concrete type required at this use site.
- 02
type Box<T = unknown> = { value: T } const box: Box = { value: 1 }
Add a safe default only when the generic has a meaningful general case.
Takeaway
Every required type parameter needs an argument, just as every required function parameter needs a value.
