title: TypeScript error: Type 'string' is not assignable to type 'number | ""'
body: <p>I'm new to TypeScript and I'm having a hard time understanding the following error.</p>
  <pre><code>Type '{ order: string; }[]' is not assignable to type 'TestType[]'.
    Type '{ order: string; }' is not assignable to type 'TestType'.
      Types of property 'order' are incompatible.
        Type 'string' is not assignable to type 'number | &quot;&quot;'.
  </code></pre>
  <p>This is my test code</p>
  <pre><code>export enum ACTION_TYPES {
      TEST_ACTION = 'TEST_ACTION',
  }
  
  
  export type TestType = {
      order: number | '';
  };
  
  export function TestAction(
      testTypes: TestType[]
  ): {
      type: ACTION_TYPES.TEST_ACTION;
      testTypes: TestType[];
  } {
      return {
          type: ACTION_TYPES.TEST_ACTION,
          testTypes,
      };
  }
  
  export type PluginsState = {
      testTypes: TestType[];
  };
  
  export type Actions =
      | ReturnType&lt; typeof TestAction &gt;;
  
  
  
  const reducer = (
      state: PluginsState = {
          testTypes: [],
      },
      payload?: Actions
  ): PluginsState =&gt; {
      if ( payload &amp;&amp; 'type' in payload ) {
          switch ( payload.type ) {
              case ACTION_TYPES.TEST_ACTION:
                  return {
                      ...state,
                      testTypes: payload.testTypes,
                  };
          }
      }
      return state;
  };
  
  export const stub = [
      {
          order: '',
      }
  ];
  
  
  const defaultState: PluginsState = {
      testTypes: [],
  };
  
  
  reducer( defaultState, {
      type: ACTION_TYPES.TEST_ACTION,
      testTypes: stub,
  } );
  
  </code></pre>
  <p>and this is TypeScript playground <a href="https://www.typescriptlang.org/play?#code/KYDwDg9gTgLgBMAdgVwLZwIIGEAqBJAeQDkB9HATQAUBRAZTgG8AoASBzpxO32LgF44Acna1O3QkUEAaJgF8mC0JFhwYATzDA4OYAGcYODVoHMW0ACbAoALjgpUAIytwAPkMEBuOV6ZLo8ADNkRABjGABLCERtPRgMMMjEAApWGFjDTV1bHX0M4ABtAF0mAEpbU3VNW3FiMio6ADoRMVwJLxY03KMsmK7NIq9ZRlYoYBhkKGjTDqNq1tqKGlomji55ohkWDvTuzdlBxXB-VSM4SgAbZABzcMRdWhgAQzT+Ye2+vWyd-sLBnz8VJUtPEIlFdPxWG4AEpjCaIPIAHhOmggAV6cQSUTgAD4fAoQmD4KNzMgQs4BCkWPpnsBbBdrrd7k8XiZWO8DN1bEU9pswI81OcII9zAB+aqYu6lOmXG53B40-jYt7hNFJOB8gVC8xwABkOqEQMEcFu6v5guFcBKbypAHdwjAQgALOBqjXm8wNIGW60sEKPXTA9Z1JYrURrHhEaxsrajcaTH1bBpJ6lpTZbLadDmZWxurWe756NNbfZs+QsMuxuFwFPAP6HZTwAl3eD6ZAOV75VjTCxWWyCaSseS-BRMJv6OCWAKPZDnGDytLShly5nGN6ZvI9bneEfE0lWNWT6ez+fAKRr2aYIOLRrNcMSTbrznV8YOGRDEpeIA" rel="nofollow noreferrer">link</a></p>
  <p>The error comes from the last line <code>testTypes: stub</code></p>
  <p>I'm pretty sure there is something I'm doing wrong, but I'm not understanding why <code>''</code> cannot be used with <code>number | &quot;&quot;</code></p>
  <p>Is there a workaround to this error?</p>