From a27f175a3b192c5de271a7e226575b7574f8096a Mon Sep 17 00:00:00 2001 From: Momo Kornher Date: Fri, 26 Apr 2024 10:22:42 +0100 Subject: [PATCH] fix(reflect): additional type predicates for `isXyzType` methods --- packages/jsii-reflect/lib/enum.ts | 2 +- packages/jsii-reflect/lib/interface.ts | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/jsii-reflect/lib/enum.ts b/packages/jsii-reflect/lib/enum.ts index ac9c6bbd64..6e4db8eaa0 100644 --- a/packages/jsii-reflect/lib/enum.ts +++ b/packages/jsii-reflect/lib/enum.ts @@ -18,7 +18,7 @@ export class EnumType extends Type { return this.spec.members.map((m) => new EnumMember(this, m)); } - public isEnumType() { + public isEnumType(): this is EnumType { return true; } } diff --git a/packages/jsii-reflect/lib/interface.ts b/packages/jsii-reflect/lib/interface.ts index d02ec2933b..05567cce07 100644 --- a/packages/jsii-reflect/lib/interface.ts +++ b/packages/jsii-reflect/lib/interface.ts @@ -72,11 +72,11 @@ export class InterfaceType extends ReferenceType { return Object.fromEntries(this._getMethods(inherited, this)); } - public isDataType() { + public isDataType(): this is InterfaceType { return !!this.spec.datatype; } - public isInterfaceType() { + public isInterfaceType(): this is InterfaceType { return true; }