Skip to content

Commit

Permalink
feat: add Type.isTemplateLiteral method (#1288)
Browse files Browse the repository at this point in the history
  • Loading branch information
shaharkazaz committed Jun 3, 2022
1 parent c7f3512 commit 284a7fd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
17 changes: 9 additions & 8 deletions docs/details/types.md
Expand Up @@ -200,25 +200,26 @@ type.isAnonymous();
type.isAny();
type.isArray();
type.isBoolean();
type.isString();
type.isNumber();
type.isBooleanLiteral();
type.isClass();
type.isClassOrInterface();
type.isEnum();
type.isEnumLiteral();
type.isInterface();
type.isIntersection();
type.isLiteral();
type.isBooleanLiteral();
type.isStringLiteral();
type.isNull();
type.isNumber();
type.isNumberLiteral();
type.isEnumLiteral();
type.isObject();
type.isString();
type.isStringLiteral();
type.isTemplateLiteral();
type.isTuple();
type.isUndefined();
type.isUnion();
type.isIntersection();
type.isUnionOrIntersection();
type.isUnknown();
type.isNull();
type.isUndefined();
```

If you see something that doesn't exist here and should (there's a lot missing), then please log an issue or submit a pull request.
Expand Down
7 changes: 7 additions & 0 deletions packages/ts-morph/src/compiler/types/Type.ts
Expand Up @@ -389,6 +389,13 @@ export class Type<TType extends ts.Type = ts.Type> {
return symbol.getName() === "Array" && this.getTypeArguments().length === 1;
}

/**
* Gets if this is a boolean type.
*/
isTemplateLiteral() {
return this._hasTypeFlag(TypeFlags.TemplateLiteral);
}

/**
* Gets if this is a boolean type.
*/
Expand Down

0 comments on commit 284a7fd

Please sign in to comment.