[英]How to fix “Property 'should' does not exist on type 'string'” error in a TypeScript project using mocha?
在我正在使用TypeScript的NodeJS项目中,有一些.ts文件具有使用mocha的测试。 我已经将测试文件从javascript移植到TypeScript,并且在以下几行中遇到这些错误:
Property 'should' does not exist on type 'number'.
Property 'should' does not exist on type 'boolean'.
Property 'should' does not exist on type 'string'.
我以前在其他一些回购中已经看到过这一点,并且记得修复它,但是现在我根本不记得自己做了什么!
更改
require('should');
至
import * as should from 'should';
因为我正在将该文件从原始JS移植到TypeScript,所以我只更改了一些require
语句,但没有更改每一个。 记住要全部改变!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.