什么是泛型,泛型的具体使用 定义:定义函数、接口或类时,不预先指定类型,使用时再指定使用interfact Test<T = any> { userId: T; } type TestA = Test<string>; type TestB = Test<number>; const a: TestA = { userId: '111' } const b: TestB = { userId: 222 }