# 01 · inference-from-arguments **演示**:泛型的类型参数可以从实参推断,也可以显式指定;运行时全部擦除。 **运行**:在 `tutorials/typescript` 下执行 `npm run build`,再执行 `npm run serve`,打开 `http://localhost:8080/examples/06-generics/01-inference-from-arguments/`;开 Console。 **预期控制台输出**: ```text 1:a x:1 ab|ab ``` **类型检查**:`node node_modules/typescript/bin/tsc -p examples/06-generics/01-inference-from-arguments/tsconfig.types.json` **注意**:推断不会把 `1` 收窄成字面量 `1`,除非使用 `const` 类型参数或用 `as const`。