Azure/azure-cosmos-js

Cannot find name 'AbortSignal'

duncanchen opened this issue · 7 comments

Hi,

When import {CosmosClient} from '@azure/cosmos', the TS complains about missing type for AbortSignal.

node_modules/@azure/cosmos/dist/index.d.ts:2414:19 - error TS2304: Cannot find name 'AbortSignal'.

2414     abortSignal?: AbortSignal;

Wonder if that's indeed missing.

@duncanchen which version of TS are you on? Can you also share your tsconfig?

@Nixes @duncanchen Are you able to share your tsconfig and what version of TypeScript you are running? I am not yet able to reproduce this.

I have the same issue. It appears when i update azure/cosmos from 2.1.7 to 3.1.1
Node: 10.16.3 LTS
Typescript: 3.5.3

@Amphibium can your share your tsconfig?

{
  "compileOnSave": true,
  // https://www.typescriptlang.org/docs/handbook/compiler-options.html
  "compilerOptions": {
    
    /* Basic Options */
    "target": "es2018",                       /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017','ES2018' or 'ESNEXT'. */
    "module": "commonjs",                     /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
    "lib": ["es2018"],                        /* Specify library files to be included in the compilation. */
    "extendedDiagnostics": true,
    "declaration": true,                      /* Generates corresponding '.d.ts' file. */
    "sourceMap": true,                        /* Generates corresponding '.map' file. */
    "outDir": "dist",                         /* Redirect output structure to the directory. */
    "rootDir": "./src",                       /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
    "removeComments": true,                   /* Do not emit comments to output. */
    "importHelpers": true,                    /* Import emit helpers from 'tslib'. */

    /* Strict Type-Checking Options */
    "strict": true,                           /* Enable all strict type-checking options: noImplicitAny, strictNullChecks, strictFunctionTypes, strictPropertyInitialization, noImplicitThis, alwaysStrict. */

    /* Additional Checks */
    "noUnusedLocals": false,                /* Report errors on unused locals. */
    "noUnusedParameters": false,            /* Report errors on unused parameters. */
    "noImplicitReturns": false,             /* Report error when not all code paths in function return a value. */
    "noFallthroughCasesInSwitch": false,    /* Report errors for fallthrough cases in switch statement. */

    /* Module Resolution Options */
    "moduleResolution": "node",               /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
    "esModuleInterop": true,                  /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */

    /* Otras opciones*/
    "suppressImplicitAnyIndexErrors": true,

  },
  "include": [
    "src/**/*.ts"
  ],
  "exclude": [
    "./node_modules"
  ],
  "awesomeTypescriptLoaderOptions": {
    "usePrecompiledFiles": true,
    "useWebpackText": true
  }
}

Thanks! I see the issue now. We use AbortController types which are contained in the DOM lib. Add "dom" to your "lib" array in tsconfig as a workaround. I will investigate a more permanent fix.

It works!! Thanks you.