How to use the jsii-reflect.Type function in jsii-reflect

To help you get started, we’ve selected a few jsii-reflect examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws / aws-cdk / packages / decdk / lib / jsii2schema.ts View on Github external
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;