如题,fetch请求直接报参数类型错误
- 同样的代码在windows下的vscode中使用正常
- 在Mac OS X下使用时报错
代码
function test(params?:any) {
fetch('localhost:8003',{
headers:{
}
})
}
报错信息
ERROR in [at-loader] ./src/index.tsx:75:28
TS2345: Argument of type '{ headers: {}; }' is not assignable to parameter of type 'RequestInit'.
Types of property 'headers' are incompatible.
Type '{}' is not assignable to type 'Headers | string[][]'.
Type '{}' is not assignable to type 'string[][]'.
Property '[Symbol.unscopables]' is missing in type '{}'.
在使用ant design时候也出现这种类型判断错误导致编译失败的情况