Skip to main content
Module

x/ts_morph/mod.ts>Type#getTargetType

TypeScript Compiler API wrapper for static analysis and programmatic code changes.
Very Popular
Go to Latest
method Type.prototype.getTargetType
import { Type } from "https://deno.land/x/ts_morph@15.1.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> returns Promise<T>.
  • Given generic type Promise<T> returns the same Promise<T>.
  • Given string returns undefined.

Returns

Type<ts.GenericType> | undefined