【问题标题】:Can not use querymen with typescript?不能使用带有打字稿的查询员?
【发布时间】:2022-10-06 19:06:30
【问题描述】:

我正在使用\"querymen\" 库将查询字符串解析为mongodb | mongoose 查询,我正在TypeScript 中编写我的代码

import { middleware as query } from \'querymen\';
 // then the route .
xRouter.get(\'/\', query(), ...... );

但总是给我错误:

Could not find a declaration file for module \'querymen\'. \'/Users/meroo/Desktop/erp-next/erpnext/node_modules/querymen/dist/index.js\' implicitly has an \'any\' type.
  Try `npm i --save-dev @types/querymen` if it exists or add a new declaration (.d.ts) file containing `declare module \'querymen\';`

我尝试了很多方法来解决这个问题,但它不起作用

    标签: node.js typescript mongoose typescript-typings


    【解决方案1】:

    该库没有可用的类型,您需要自己编写它,方法是创建一个包含declare module 'querymen';d.ts 文件

    【讨论】:

      猜你喜欢
      • 2021-06-30
      • 1970-01-01
      • 1970-01-01
      • 2019-06-07
      • 2015-10-23
      • 2017-02-19
      • 2021-04-22
      • 1970-01-01
      • 2021-08-11
      相关资源
      最近更新 更多