title: Assign correct types to Reselect createSelector function
body: <p>Edit: added package.json excerpt</p>
  
  <p>I am trying to implement typescript in an existing React project and I am facing difficulties with <a href="https://github.com/reactjs/reselect" rel="noreferrer">Reselect</a> library.
  Typescript compiler insists on importing the first definition of createSelector function and fails recognize that my function's signature corresponds to another definition.</p>
  
  <p>The definition it imports:</p>
  
  <pre><code>export function createSelector&lt;S, R1, T&gt;(
    selector: Selector&lt;S, R1&gt;,
    combiner: (res: R1) =&gt; T,
  ): OutputSelector&lt;S, T, (res: R1) =&gt; T&gt;;
  </code></pre>
  
  <p>The one I want to use:</p>
  
  <pre><code>export function createSelector&lt;S, R1, R2, T&gt;(
    selectors: [Selector&lt;S, R1&gt;,
                Selector&lt;S, R2&gt;],
    combiner: (res1: R1, res2: R2) =&gt; T,
  ): OutputSelector&lt;S, T, (res1: R1, res2: R2) =&gt; T&gt;;
  </code></pre>
  
  <p>Here is my actual code:</p>
  
  <pre><code>// groups.selectors.tsx
  
  import { Selector, createSelector } from 'Reselect';
  import { IGroup, IQuestionnaire, IGroupReselect, IState } from '../interfaces';
  
  const getGroups:Selector&lt;IState, IGroup[]&gt; = state =&gt; state.groups;
  const getQuestionnaires:Selector&lt;IState, IQuestionnaire[]&gt; = state =&gt; state.questionnaires;
  
  export const groups = createSelector&lt;IState, IGroup[], IQuestionnaire[], IGroupReselect&gt;(
    [getGroups, getQuestionnaires],
    (g, q) =&gt; {
  
      return g.map(group =&gt; Object.assign(
        {},
        group,
        {questionnaires: group.questionnairesIds.map(id =&gt; q.find(q =&gt; q.id === id))}
      ));
    }
  );
  </code></pre>
  
  <p>And in case it my be of any help, here is my ts.config:</p>
  
  <pre><code>{
    "compilerOptions": {
      "module": "es6",
      "target": "es6",
      "outDir": ".temp",
      "allowSyntheticDefaultImports": true,
      "baseUrl": "src",
      "noImplicitAny": false,
      "sourceMap": false,
      "jsx": "preserve",
      "strict": true,
      "moduleResolution": "node"
    },
    "exclude": [
      "node_modules"
    ],
    "files": [
      "typings.d.ts"
    ]
  }
  </code></pre>
  
  <p>I am not completely comfortable with TypeScript so there is certainly something wrong in my implementation. What bugs me is that if I write the simplest possible reselector, that is one with only 1 selector and a combiner of arity 1, it passes type checking which gives me the impression that the compiler does not properly pick the correct definition among overloaded functions in Reselect's <a href="https://github.com/reactjs/reselect/blob/master/src/index.d.ts" rel="noreferrer">index.d.ts</a></p>
  
  <p>Here are relevant parts of my package.json:</p>
  
  <pre><code>"dependencies": {
      "react": "^15.5.4",
      "react-dom": "^15.5.4",
      "react-redux": "^5.0.5",
      "react-router": "^4.1.1",
      "react-router-dom": "^4.1.1",
      "redux": "^3.6.0",
      "redux-devtools-extension": "^2.13.2",
      "redux-thunk": "^2.2.0",
      "reselect": "^3.0.1"
    },
    "devDependencies": {
      "@types/react": "^15.0.25",
      "@types/react-router-dom": "^4.0.4",
      "@types/redux-thunk": "^2.1.0",
      "typescript": "^2.3.3"
    },
  </code></pre>