小编Ant*_*ños的帖子

无法解析模块“firebase-admin/app”的路径(ESLint)

我正在尝试按照文档连接到我的 Firebase 应用程序但 ESLint 正在抱怨。我已经检查过相关问题,但那里提出的解决方案似乎对我不起作用。我有以下 .eslint.js 文件:

module.exports = {
  extends: [
    'airbnb-typescript/base',
    'eslint:recommended',
    'plugin:@typescript-eslint/recommended',
    'plugin:typescript-sort-keys/recommended',
    'plugin:import/recommended',
    'prettier'
  ],
  parser       : '@typescript-eslint/parser',
  parserOptions: {
    ecmaFeatures: {
      modules: true
    },
    ecmaVersion: 6,
    project    : './tsconfig.json',
    sourceType : 'module'
  },
  plugins: ['@typescript-eslint', 'typescript-sort-keys', 'sort-keys-fix'],
  rules  : { ... }
}
Run Code Online (Sandbox Code Playgroud)

firebase typescript eslint firebase-admin

25
推荐指数
2
解决办法
4227
查看次数

命名空间“NodeJS”没有导出成员“Global”

我曾经使用以下代码定义全局变量:

interface CustomNodeJSGlobal extends NodeJS.Global {
  myGlobalVariable: unknown
}

export { CustomNodeJSGlobal }
Run Code Online (Sandbox Code Playgroud)

在 Node 14 中,但是当我安装时@types/node(目前是版本 16),它会抛出一个错误Namespace 'NodeJS' has no exported member 'Global'。如何在 Node 16 及以上版本中声明全局变量?

node.js typescript

8
推荐指数
1
解决办法
5304
查看次数

标签 统计

typescript ×2

eslint ×1

firebase ×1

firebase-admin ×1

node.js ×1