打开 'esModuleInterop' 标志

Turning on the 'esModuleInterop' flag

我正在为我的应用程序使用 Firebase Functions。我在我的电脑上安装了这些 firebase 功能,但我不能使用以下命令:

Firebase deploy --only functions

我收到以下错误:

node_modules/google-gax/build/protos/iam_service.d.ts:17:23 - error TS2497: This module 
can only be referenced with ECMAScript imports/exports by turning on the 
'esModuleInterop' flag and referencing its default export.

17 import * as Long from 'long';
                       ~~~~~~

node_modules/google-gax/build/protos/operations.d.ts:17:23 - error TS2497: This module 
can only be referenced with ECMAScript imports/exports by turning on the 
'esModuleInterop' flag and referencing its default export.

17 import * as Long from 'long';
                         ~~~~~~

Found 2 errors in 2 files.

Errors  Files
 1  node_modules/google-gax/build/protos/iam_service.d.ts:17
 1  node_modules/google-gax/build/protos/operations.d.ts:17

Error: functions predeploy error: Command terminated with non-zero exit code2

有谁知道如何打开这个标志?

只需将 "skipLibCheck": true 添加到您的 tsconfig.json 中,如下所示:

"compilerOptions": {
    "module": "commonjs",
    "noImplicitReturns": true,
    "noUnusedLocals": true,
    "outDir": "lib",
    "sourceMap": true,
    "strict": true,
    "target": "es2017",
    "skipLibCheck": true
  },