Skip to main content
Module

x/ts_morph/ts_morph.d.ts>Type#getTargetTypeOrThrow

TypeScript Compiler API wrapper for static analysis and programmatic code changes.
Very Popular
Latest
method Type.prototype.getTargetTypeOrThrow
import { Type } from "https://deno.land/x/ts_morph@22.0.0/ts_morph.d.ts";

Returns the generic type when the type is a type reference, returns itself when it's already a generic type, or otherwise throws an error.

For example:

  • Given type reference Promise<string> returns Promise<T>.
  • Given generic type Promise<T> returns the same Promise<T>.
  • Given string throws an error.

Parameters

optional
message: string | (() => string)

Returns

Type<ts.GenericType>