function validateValueOf()

in compiler/src/steps/validate-model.ts [776:812]


  function validateValueOf (valueOf: model.ValueOf, openGenerics: Set<string>): void {
    context.push(valueOf.kind)
    switch (valueOf.kind) {
      case 'instance_of':
        validateTypeRef(valueOf.type, valueOf.generics, openGenerics)
        break

      case 'array_of':
        validateValueOf(valueOf.value, openGenerics)
        break

      case 'union_of':
        for (const item of valueOf.items) {
          validateValueOf(item, openGenerics)
        }
        break

      case 'dictionary_of':
        validateValueOf(valueOf.key, openGenerics)
        validateValueOf(valueOf.value, openGenerics)
        break

      case 'user_defined_value':
        // Nothing to validate
        break

      case 'literal_value':
        // Nothing to validate
        break

      default:
        // @ts-expect-error
        // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
        throw new Error(`Unknown kind: ${valueOf.kind}`)
    }
    context.pop()
  }