import { Type } from "https://deno.land/x/ts_morph@16.0.0/mod.ts";
Returns the generic type when the type is a type reference, returns itself when it's already a generic type, or otherwise returns undefined.
For example:
- Given type reference
Promise<string>
returnsPromise<T>
. - Given generic type
Promise<T>
returns the samePromise<T>
. - Given
string
returnsundefined
.