无法将现有的ws从javascript转换为打字稿。不能理解异步socketHost函数的返回类型是什么,为什么我不能通过'this'关键字
访问它们代码如下:
<leader>s
错误:
{
folders.map((folder,_index1) => {
return (
<> // or <React.Fragment> with the corresponding closing tag
<div>{folder}</div> // this has to be part of what is returned
items.map((item, index) => {
return (
<div>
{(folder === item.folder) ?
...
</>
)})
)})
}
socket.ts
const config = {
production: {
socketHost: 'wss://someName.com/ws',
},
development: {
socketHost: 'ws://localhost:5555',
},
};
module.exports = config[process.env.NODE_ENV || 'production'];
错误
Cannot compile namespaces when the '--isolatedModules' flag is provided.
这时我已经重写了整个应用程序,我碰壁了,即使看了3个小时的文档,也不知道如何重写此部分。
任何帮助将不胜感激