Error: TS Error: Subsequent variable declarations must have the same type. Variable ‘beforeEach’ must be of type ‘Lifecycle’, but here has type ‘HookFunction’. 错误解决方法
如果在TypeScript开发或者Midway.js开发中,在编译工程时出现以上错误,原因就是发生了变量的重复定义。可能是由于之前用npm同时安装了@types/jest
和@types/mocha
两个包导致的,解决方法就是删除两个包其中之一。
比如:
npm uninstall @types/mocha
或者
npm uninstall @types/jest
之后再执行编译就可以通过了。