# 04 · generic-identity **演示**:`identity` 保留字面量类型;`NoInfer` 阻止 `fallback` 把 `T` 拓宽。 **运行**:在 `tutorials/typescript` 下执行 `npm run build`,再执行 `npm run serve`,打开 `http://localhost:8080/examples/05-function-types-overloads/04-generic-identity/`;开 Console。 **预期控制台输出**: ```text ts 1 2,4,6 0:a|1:b ``` **类型检查**:`node node_modules/typescript/bin/tsc -p examples/05-function-types-overloads/04-generic-identity/tsconfig.types.json` **注意**:`firstOr([1, 2], 'x')` 在负例里必须报错;去掉 `NoInfer` 会退化成 `number | string`。