function _assertPropertiesMatch()

in src/validator.ts [366:433]


    function _assertPropertiesMatch(expected: spec.Property, actual: spec.Property, label: string, action: string) {
      const actualNode = bindings.getPropertyRelatedNode(actual);
      const expectedNode = bindings.getPropertyRelatedNode(expected);
      if (!!expected.protected !== !!actual.protected) {
        const expVisibility = expected.protected ? 'protected' : 'public';
        const actVisibility = actual.protected ? 'protected' : 'public';
        diagnostic(
          JsiiDiagnostic.JSII_5002_OVERRIDE_CHANGES_VISIBILITY.create(
            actualNode?.modifiers?.find(
              (mod) => mod.kind === ts.SyntaxKind.PublicKeyword || mod.kind === ts.SyntaxKind.ProtectedKeyword,
            ) ?? declarationName(actualNode),
            label,
            action,
            actVisibility,
            expVisibility,
          ).maybeAddRelatedInformation(
            expectedNode?.modifiers?.find(
              (mod) => mod.kind === ts.SyntaxKind.PublicKeyword || mod.kind === ts.SyntaxKind.ProtectedKeyword,
            ) ?? declarationName(expectedNode),
            'The implemented declaration is here.',
          ),
        );
      }
      if (!deepEqual(expected.type, actual.type)) {
        diagnostic(
          JsiiDiagnostic.JSII_5004_OVERRIDE_CHANGES_PROP_TYPE.create(
            actualNode?.type ?? declarationName(actualNode),
            label,
            action,
            actual.type,
            expected.type,
          ).maybeAddRelatedInformation(
            expectedNode?.type ?? declarationName(expectedNode),
            'The implemented declaration is here.',
          ),
        );
      }
      if (expected.immutable !== actual.immutable) {
        diagnostic(
          JsiiDiagnostic.JSII_5010_OVERRIDE_CHANGES_MUTABILITY.create(
            actualNode?.modifiers?.find((mod) => mod.kind === ts.SyntaxKind.ReadonlyKeyword) ??
              declarationName(actualNode),
            label,
            action,
            actual.immutable,
            expected.immutable,
          ).maybeAddRelatedInformation(
            expectedNode?.modifiers?.find((mod) => mod.kind === ts.SyntaxKind.ReadonlyKeyword) ??
              declarationName(expectedNode),
            'The implemented declaration is here.',
          ),
        );
      }
      if (expected.optional !== actual.optional) {
        diagnostic(
          JsiiDiagnostic.JSII_5009_OVERRIDE_CHANGES_PROP_OPTIONAL.create(
            actualNode?.questionToken ?? actualNode?.type ?? declarationName(actualNode),
            label,
            action,
            actual.optional,
            expected.optional,
          ).maybeAddRelatedInformation(
            expectedNode?.questionToken ?? expectedNode?.type ?? declarationName(expectedNode),
            'The implemented declaration is here.',
          ),
        );
      }
    }