title: 'Promise<void>' is not assignable to type 'Promise<IListItem[]>
body: <p>I have the following error:</p>
  
  <pre><code>[ts]
  Type 'Promise&lt;void&gt;' is not assignable to type 'Promise&lt;IListItem[]&gt;'.
    Type 'void' is not assignable to type 'IListItem[]'.
  (method) Promise&lt;{
      value: IListItem[];
  }&gt;.then&lt;void&gt;(onFulfilled?: (value: {
      value: IListItem[];
  }) =&gt; void | Thenable&lt;void&gt;, onRejected?: (error: any) =&gt; void | Thenable&lt;void&gt;): Promise&lt;void&gt; (+2 overloads)
  </code></pre>
  
  <p>In the following piece of code, what am I missing?</p>
  
  <pre><code>import { SPHttpClient, SPHttpClientResponse } from "@microsoft/sp-http";
  import { IWebPartContext } from "@microsoft/sp-webpart-base";
  import { IListItem} from "./models/IListItem";
  import { IFactory } from "./IFactory";
  import { INewsListItem } from "./models/INewsListItem";
  import { IDirectoryListItem } from "./models/IDirectoryListItem";
  import { IAnnouncementListItem } from "./models/IAnnouncementListItem";
  
  export class ListItemFactory implements IFactory {
      private _listItems: IListItem[];
      public getItems(requester: SPHttpClient, siteUrl: string, listName: string): Promise&lt;IListItem[]&gt; {
          switch(listName) {
              case "GenericList":
                  let items: IListItem[];
                  // tslint:disable-next-line:max-line-length
                  return requester.get(`${siteUrl}/_api/web/lists/getbytitle('${listName}')/items?$select=Title,Id,Modified,Created,Author/Title,Editor/Title&amp;$expand=Author,Editor`,
                  SPHttpClient.configurations.v1,
                  {
                      headers: {
                          "Accept": "application/json;odata=nometadata",
                          "odata-version": ""
                      }
                  })
                  .then((response: SPHttpClientResponse): Promise&lt;{ value: IListItem[] }&gt; =&gt; {
                      return response.json(); 
                  })
                  .then((json: { value: IListItem[] }) =&gt; {
                      console.log(JSON.stringify(json.value));
                      items=json.value.map((v,i)=&gt;({ 
                          key: v.id,
                          id: v.id,
                          title: v.title,
                          created: v.created,
                          createdby: v.Author.Title,
                          modified: v.modified,
                          modifiedby: v.Editor.Title                        
                      }));
  </code></pre>
  
  <p>Update 1:</p>
  
  <p>the consumer of the above method:</p>
  
  <pre><code> // read items using factory method pattern and sets state accordingly
    private readItemsAndSetStatus(): void {
      this.setState({
        status: "Loading all items..."
      });
  
      const factory: ListItemFactory = new ListItemFactory();
      factory.getItems(this.props.spHttpClient, this.props.siteUrl, this.props.listName)
      .then((items: IListItem[]) =&gt; {
        const keyPart: string = this.props.listName === "GenericList" ? "" : this.props.listName;
          // the explicit specification of the type argument `keyof {}` is bad and
          // it should not be required.
          this.setState&lt;keyof {}&gt;({
            status: `Successfully loaded ${items.length} items`,
            ["Details" + keyPart + "ListItemState"] : {
              items
            },
            columns: buildColumns(items)
          });
      });
    }
  </code></pre>