title: How to fix "Argument of type 'string' is not assignable to parameter of type 'never'" with use of keyof type definition
body: <p>I'm using a central Redux store and have the following action typed:</p>
  <pre><code>setProperty: &lt;AppState, K extends keyof AppState&gt;(
        key: K,
        value: AppState[K]
      ): void =&gt; {
        set({
          [key]: value,
        });
      }
  </code></pre>
  <p>AppState is the following:</p>
  <pre><code>type AppState = {
  loading: boolean;
  error: string;
  data: DataDTO;
  };
  </code></pre>
  <p>So the action takes a key (which has to be a key that is defined in the AppState type), and takes a value parameter, which is one of the type definition of the individual keys of AppState. So key can only be loading, error and data, while the value parameter can only be of type boolean, string or DataDTO.</p>
  <p>However, when I use the setProperty action:</p>
  <pre><code>  setProperty(
      'data',
      computedData
    );
  </code></pre>
  <p>Typescript fires an error for the &quot;data&quot; string, saying that:</p>
  <pre><code>Argument of type 'string' is not assignable to parameter of type 'never'
  </code></pre>
  <p>It's saying that no type is expected and I gave it a string, so it's throwing an error. How can I go about fixing this and getting it to work nicely with typescript?</p>
  <p>Thanks for any help!</p>