Typescript generics call the literal amount of the object of the signature to define the generic function error.

use the literal amount of the object with the call signature to define the generic function

interface IGenericIdentityFn1 {

}
function identity<T>(arg: T): T {
      return arg;
    }
const myIdentityFn: {<T>(arg: T): T} = identity;
const myIdentityFn2: IGenericIdentityFn1 = identity;

both of these methods report errors
ERROR:

callable-types: Type literal has only a call signature-use < T > (arg: t) = > T instead

could you tell me how to solve it?

May.14,2022

const myIdentityFn = identity;

just change it to this

const myIdentityFn: < T > (arg: t) = > T = identity;


typescript 3.2.2 No pressure

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bcae6c-30a50.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bcae6c-30a50.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?