title: GraphQL with Typescript: Resolver Type Error
body: <p>Using apollo-graphql, I've created an "account" type and accompanying resolver that uses <a href="https://www.npmjs.com/package/graphql-iso-date" rel="nofollow noreferrer">graphql-iso-date</a>. The configuration results in the following errors, any ideas on cause and resolution?</p>
  
  <p>In the code included below, typedefs are combined into a collection from specific typedef modules. </p>
  
  <blockquote>
    <p>Type '{ Date: GraphQLScalarType; DateTime: GraphQLScalarType; Time:
    GraphQLScalarType; } | { Query: AccountQueryResolver; }' is not
    assignable to type 'IResolvers | IResolvers[] |
    undefined'.</p>
    
    <p>Type '{ Date: GraphQLScalarType; DateTime:
    GraphQLScalarType; Time: GraphQLScalarType; }' is not assignable to
    type 'IResolvers | IResolvers[] | undefined'.</p>
    
    <p>Type '{ Date: GraphQLScalarType; DateTime: GraphQLScalarType; Time:
    GraphQLScalarType; }' is not assignable to type 'IResolvers'. Property 'Date' is incompatible with index signature</p>
    
    <p>Type 'GraphQLScalarType' is not assignable to type '(() => any) |
    GraphQLScalarType | IEnumResolver | IResolverObject |
    IResolverOptions'.</p>
    
    <p>Type 'GraphQLScalarType'
    is not assignable to type 'IResolverObject'.<br>
    Index signature is missing in type 'GraphQLScalarType'.</p>
  </blockquote>
  
  <hr>
  
  <p><strong>TypeDefs Collection</strong></p>
  
  <pre><code>import CustomScalarTypeDefs from "./custom";
  import QueryTypeDefs from "./query";
  import AccountTypeDefs from "./account";
  
  const TypeDefs = [CustomScalarTypeDefs, QueryTypeDefs, AccountTypeDefs];
  
  export default TypeDefs;
  </code></pre>
  
  <hr>
  
  <p><strong>Custom Scalar TypeDefs</strong></p>
  
  <pre><code>import { gql } from "apollo-server-express";
  
  const customScalarTypeDefs = gql`
    scalar Date
    scalar DateTime
    scalar Time
  `;
  
  export default customScalarTypeDefs;
  </code></pre>
  
  <hr>
  
  <p><strong>Query TypeDefs</strong></p>
  
  <pre><code>import { gql } from "apollo-server-express";
  
  const QueryTypeDefs = gql`
    type Query {
      account(id: String!): Account
    }
  `;
  
  export default QueryTypeDefs;
  </code></pre>
  
  <hr>
  
  <p><strong>Custom Scalar Resolver</strong></p>
  
  <pre><code>import { GraphQLDate, GraphQLDateTime, GraphQLTime } from "graphql-iso-date";
  
  const CustomScalarResolver = {
    Date: GraphQLDate,
    DateTime: GraphQLDateTime,
    Time: GraphQLTime
  };
  
  export default CustomScalarResolver;
  </code></pre>
  
  <hr>
  
  <p><strong>Account Resolver</strong></p>
  
  <pre><code>import { QueryById } from "./signatures";
  import Account, { AccountModel, AccountPayload } from "../../models/account";
  
  interface AccountQueryResolver {
    account: (_: never, req: QueryById) =&gt; Promise&lt;AccountModel | null&gt;;
    createAccount: (
      parent: Account | null,
      { entity, name }: AccountPayload
    ) =&gt; Promise&lt;AccountModel | null&gt;;
  }
  
  const accountResolver: AccountQueryResolver = {
    account: (_, { id }): Promise&lt;AccountModel | null&gt; =&gt; {
      return Account.findOne({ _id: id }).exec();
    },
    createAccount: (_, { entity, name }): Promise&lt;AccountModel | null&gt; =&gt; {
      return Account.create({ entity, name });
    }
  };
  
  export default accountResolver;
  </code></pre>