title: Why does injecting the sanity client in a nestjs service provider result in a "TypeError: client_1.default is not a function"?
body: <p>Creating a service provider in <a href="https://nestjs.com/" rel="nofollow noreferrer">nestjs</a> and importing a <a href="https://www.sanity.io/docs/js-client" rel="nofollow noreferrer">sanity client</a>:</p>
  <pre><code>import { Injectable } from '@nestjs/common';
  import sanityClient, { SanityClient } from '@sanity/client';
  
  @Injectable()
  export class SanityService {
    public readonly client: SanityClient = sanityClient({
      projectId: '******',
      dataset: '********',
      apiVersion: '2021-08-18',
      token: '*******',
      useCdn: false,
    });
  }
  </code></pre>
  <p>Results in:</p>
  <pre><code>[Nest] 53293  - 08/18/2021, 2:05:07 PM   ERROR [ExceptionHandler] client_1.default is not a function
  TypeError: client_1.default is not a function
      at new SanityService (/**/src/sanity/sanity.service.ts:6:54)
      at Injector.instantiateClass (/**/node_modules/@nestjs/core/injector/injector.js:291:19)
      at callback (/**/node_modules/@nestjs/core/injector/injector.js:43:41)
      at Injector.resolveConstructorParams (/**/node_modules/@nestjs/core/injector/injector.js:119:24)
      at Injector.loadInstance (/**/node_modules/@nestjs/core/injector/injector.js:47:9)
      at Injector.loadProvider (/**/node_modules/@nestjs/core/injector/injector.js:69:9)
      at async Promise.all (index 4)
      at InstanceLoader.createInstancesOfProviders (/**/node_modules/@nestjs/core/injector/instance-loader.js:44:9)
      at /**/node_modules/@nestjs/core/injector/instance-loader.js:29:13
      at async Promise.all (index 2)
  </code></pre>
  <p>My tsconfig looks like this:</p>
  <pre><code>{
    &quot;compilerOptions&quot;: {
      &quot;module&quot;: &quot;commonjs&quot;,
      &quot;declaration&quot;: true,
      &quot;removeComments&quot;: true,
      &quot;emitDecoratorMetadata&quot;: true,
      &quot;experimentalDecorators&quot;: true,
      &quot;allowSyntheticDefaultImports&quot;: true,
      &quot;target&quot;: &quot;es2017&quot;,
      &quot;sourceMap&quot;: true,
      &quot;outDir&quot;: &quot;./dist&quot;,
      &quot;baseUrl&quot;: &quot;./&quot;,
      &quot;incremental&quot;: true,
      &quot;skipLibCheck&quot;: true
    }
  }
  </code></pre>
  <p>Any ideas would be greatly appreciated. Thanks in advance! :)</p>