Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
export function isConstruct(typeOrTypeRef: jsiiReflect.TypeReference | jsiiReflect.Type): boolean {
let type: jsiiReflect.Type;
if (typeOrTypeRef instanceof jsiiReflect.Type) {
type = typeOrTypeRef;
} else {
if (typeOrTypeRef.arrayOfType) {
return isConstruct(typeOrTypeRef.arrayOfType);
}
if (typeOrTypeRef.mapOfType) {
return isConstruct(typeOrTypeRef.mapOfType);
}
if (typeOrTypeRef.unionOfTypes) {
return typeOrTypeRef.unionOfTypes.some(x => isConstruct(x));
}
if (typeOrTypeRef.type) {
type = typeOrTypeRef.type;