diff --git a/docs/details/types.md b/docs/details/types.md index b4d0daefd..c3cdddad8 100644 --- a/docs/details/types.md +++ b/docs/details/types.md @@ -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. diff --git a/packages/ts-morph/src/compiler/types/Type.ts b/packages/ts-morph/src/compiler/types/Type.ts index 5181e8a1c..18a927a88 100644 --- a/packages/ts-morph/src/compiler/types/Type.ts +++ b/packages/ts-morph/src/compiler/types/Type.ts @@ -389,6 +389,13 @@ export class 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. */