1

I have a generic function like this :

export function f<T >(json: Object): T {
return new T()

}

but I got this error when com'T' only refers to a type, but is being used as a value here.

how should i handle this ?

1

1 Answer 1

-4

Try this

export function f<T>(arg: T): T {
    return arg;
}
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.