title: Why is this JSON schema not assignable to this TypeScript interface?
body: <pre><code>import Ajv, { JSONSchemaType } from 'ajv'
  
  interface ExpectedBody {
      repository: {
        name: string,
      }
      push: {
        changes: [{
          old: {
            name: string,
          },
          new: {
            name: string,
          }
        }]
      }
    }
    
    const expectedBodySchema: JSONSchemaType&lt;ExpectedBody&gt; = {
      type: 'object',
      properties: {
        repository: {
          type: 'object',
          properties: {
            name: {
              type: 'string',
            },
          },
          required: ['name'],
        },
        push: {
          type: 'object',
          properties: {
            changes: {
              type: 'array',
              minItems: 0,
              items: {
                type: 'object',
                properties: {
                  old: {
                    type: 'string',
                  },
                  new: {
                    type: 'string',
                  },
                },
                required: ['old', 'new']
              },
            },
          },
          required: ['changes']
        }
      },
      required: ['repository', 'push'],
    }
  </code></pre>
  <p>I get the ts error</p>
  <blockquote>
  <p>Type '{ type: &quot;object&quot;; properties: { repository: { type: &quot;object&quot;; properties: { name: { type: &quot;string&quot;; }; }; required: &quot;name&quot;[]; }; push: { type: &quot;object&quot;; properties: { changes: { type: &quot;array&quot;; minItems: 0; items: { ...; }; }; }; required: &quot;changes&quot;[]; }; }; required: (&quot;repository&quot; | &quot;push&quot;)[]; }' is not assignable to type 'UncheckedJSONSchemaType&lt;ExpectedBody, false&gt;'.
  The types of 'properties.push' are incompatible between these types.
  Type '{ type: &quot;object&quot;; properties: { changes: { type: &quot;array&quot;; minItems: 0; items: { type: string; properties: { old: { type: string; }; new: { type: string; }; }; required: string[]; }; }; }; required: &quot;changes&quot;[]; }' is not assignable to type '{ $ref: string; } | (UncheckedJSONSchemaType&lt;{ changes: [{ old: { name: string; }; new: { name: string; }; }]; }, false&gt; &amp; { const?: { changes: [{ old: { name: string; }; new: { ...; }; }]; } | undefined; enum?: readonly { ...; }[] | undefined; default?: { ...; } | undefined; })'.
  The types of 'properties.changes' are incompatible between these types.
  Type '{ type: &quot;array&quot;; minItems: 0; items: { type: string; properties: { old: { type: string; }; new: { type: string; }; }; required: string[]; }; }' is not assignable to type '{ $ref: string; } | (UncheckedJSONSchemaType&lt;[{ old: { name: string; }; new: { name: string; }; }], false&gt; &amp; { const?: [{ old: { name: string; }; new: { name: string; }; }] | undefined; enum?: readonly [...][] | undefined; default?: [...] | undefined; })'.
  Type '{ type: &quot;array&quot;; minItems: 0; items: { type: string; properties: { old: { type: string; }; new: { type: string; }; }; required: string[]; }; }' is not assignable to type '{ type: &quot;array&quot;; items: readonly [UncheckedJSONSchemaType&lt;{ old: { name: string; }; new: { name: string; }; }, false&gt; &amp; { const?: { old: { name: string; }; new: { name: string; }; } | undefined; enum?: readonly { ...; }[] | undefined; default?: { ...; } | undefined; }] &amp; { ...; }; minItems: 1; } &amp; { ...; } &amp; { ...; ...'.
  Type '{ type: &quot;array&quot;; minItems: 0; items: { type: string; properties: { old: { type: string; }; new: { type: string; }; }; required: string[]; }; }' is not assignable to type '{ type: &quot;array&quot;; items: readonly [UncheckedJSONSchemaType&lt;{ old: { name: string; }; new: { name: string; }; }, false&gt; &amp; { const?: { old: { name: string; }; new: { name: string; }; } | undefined; enum?: readonly { ...; }[] | undefined; default?: { ...; } | undefined; }] &amp; { ...; }; minItems: 1; }'.
  Types of property 'items' are incompatible.
  Type '{ type: string; properties: { old: { type: string; }; new: { type: string; }; }; required: string[]; }' is not assignable to type 'readonly [UncheckedJSONSchemaType&lt;{ old: { name: string; }; new: { name: string; }; }, false&gt; &amp; { const?: { old: { name: string; }; new: { name: string; }; } | undefined; enum?: readonly { ...; }[] | undefined; default?: { ...; } | undefined; }] &amp; { ...; }'.
  Type '{ type: string; properties: { old: { type: string; }; new: { type: string; }; }; required: string[]; }' is not assignable to type 'readonly [UncheckedJSONSchemaType&lt;{ old: { name: string; }; new: { name: string; }; }, false&gt; &amp; { const?: { old: { name: string; }; new: { name: string; }; } | undefined; enum?: readonly { ...; }[] | undefined; default?: { ...; } | undefined; }]'.ts(2322)</p>
  </blockquote>
  <p>Despite the verbose error message I don't understand what is wrong. Do you understand what is wrong?</p>