标签: node.js typescript generics
我有一个像这样的通用函数:
export function f<T >(json: Object): T { return new T()
}
但是当com 'T' only refers to a type, but is being used as a value here.
'T' only refers to a type, but is being used as a value here.
我应该如何处理?
答案 0 :(得分:-3)
尝试
export function f<T>(arg: T): T { return arg; }