i have a sample code for generics in typescript.
const variab = function identity<Type>(arg: Type): Type {
return arg;
}
let output = variab<string>("myString");
console.log(output);
but in run have this error:
D:\practice2\index.ts:21 const variab = function identity(arg: Type): Type { ^
SyntaxError: Unexpected token '<' at internalCompileFunction (node:internal/vm:74:18) at wrapSafe (node:internal/modules/cjs/loader:1141:20) at Module._compile (node:internal/modules/cjs/loader:1182:27) at Module._extensions..js (node:internal/modules/cjs/loader:1272:10) at Module.load (node:internal/modules/cjs/loader:1081:32) at Module._load (node:internal/modules/cjs/loader:922:12) at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) at node:internal/main/run_main_module:23:47
Node.js v18.13.0