- Error
- Reported by the type checker
TS2315
Type '{0}' is not generic.
Type arguments are given to a type that has no type parameters. Remove them, or make the type generic.
What it means
Only generic types accept <...> arguments. Writing User<string> when User declares no type parameters is reported here.
Example
interface User {
name: string;
}
export const u: User<string> = { name: "a" };
ts-r-check -p tsconfig.json --pretty false ts-r outputindex.ts(5,17): error TS2315: Type 'User' is not generic.
Recorded by node scripts/verify-examples.mjs with ts-r built from commit 6deaf01. The example uses the default tsconfig: strict, target: es2022, module: esnext, moduleResolution: bundler.
How to fix
- Remove the type arguments.
- Or add a type parameter to the declaration if it should be generic.