title: Dynamoose Nested Map/Array in TypeScript Schema
body: <p>I'm trying to create a schema for the following example:</p>
  <pre><code>{
      &quot;foods&quot;: [
          {
              &quot;fruits&quot;: [{
                  &quot;apple&quot;: {
                      &quot;color&quot;: &quot;red&quot;,
                      &quot;shape&quot;: &quot;round&quot;
                  }
              }]
          }
      ]
  }
  </code></pre>
  <p>I was initially trying to do the below structure, which is technically correct and should work but fails due to the bug found in <a href="https://github.com/dynamoose/dynamoose/issues/909" rel="nofollow noreferrer">https://github.com/dynamoose/dynamoose/issues/909</a>.</p>
  <pre><code>export const FoodsSchema = new dynamoose.Schema({
    foods: {
      type: Array,
      schema: [{
        type: Object,
        schema: {
          fruits: {
            type: Array,
            schema: [{
              apple: {
              type: Object,
                schema: {
                  color: String,
                  shape: String,
                },
              },
            ],
          },
        },
      }],
    },
  });
  </code></pre>
  <p>However it does not seem to work. Was getting <code>TypeError: Cannot read property 'toLowerCase' of undefined</code>. The lowerCase error occurs because of the nested arrays or objects.</p>
  <p>I also saw <code>TypeMismatch: Expected foods.0.fruits to be of type object, instead found type object.</code> The latter occurred when I tried to change the schema thinking that may be it, but it was not the problem.</p>
  <ul>
  <li>This was using version 2.7.0.</li>
  </ul>