简体   繁体   English

Typescript 错误在本地机器上但在远程测试服务器上没有

[英]Typescript error on local machine but not on remote test server

I'm trying to use Microsoft Fabric's UI tools.我正在尝试使用 Microsoft Fabric 的 UI 工具。 This is the error I get on my local machine.这是我在本地机器上遇到的错误。

/Developer/React/TCV.ts/tcv/src/CategorySelection.tsx(94,9):
Type '(filterText: string, currentPersonas: IPersonaProps[], limitResults?: number | undefined) => IPersonaProps[] | Promise<IPersonaProps[]>' is not assignable to type '(filter: string, selectedItems?: IPersonaProps[] | undefined) => IPersonaProps[] | PromiseLike<IPersonaProps[]>'.
  Types of parameters 'currentPersonas' and 'selectedItems' are incompatible.
    Type 'IPersonaProps[] | undefined' is not assignable to type 'IPersonaProps[]'.
      Type 'undefined' is not assignable to type 'IPersonaProps[]'.  TS2322

    92 |       <CompactPeoplePicker
    93 |         // eslint-disable-next-line react/jsx-no-bind
  > 94 |         onResolveSuggestions={onFilterChanged}
       |         ^
    95 |         // eslint-disable-next-line react/jsx-no-bind
    96 |         onEmptyInputFocus={returnMostRecentlyUsed}
    97 |         getTextFromItem={getTextFromItem}

However, when I load my exact same code to codesandbox.io the error disappears and it works fine.但是,当我将完全相同的代码加载到 codesandbox.io 时,错误消失并且工作正常。 My files are the same, and package.json is identical.我的文件是一样的,package.json是一样的。 What can be causing this behavior?是什么导致了这种行为?

EXAMPLE: https://codesandbox.io/s/restless-darkness-xypss?file=/src/Search.tsx示例: https://codesandbox.io/s/restless-darkness-xypss?file=/src/Search.tsx

It worked for me also after changing the更改后它也对我有用

"strict": false,

in tsconfig.json在 tsconfig.json

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 npm run build 在本地机器上运行良好,但在远程 ubuntu 服务器上显示错误 - npm run build works fine on local machine but shows error on remote ubuntu server 从本地网络上的远程计算机访问NodeJS服务器显示空白页 - Accessing NodeJS server from remote machine on local network shows a blank page 从.network外的本地服务器访问部署在虚拟机中的网站 - Accessing a website deployed in a virtual machine from local server outside the network 如何在本地计算机上设置React和NodeJS(NPM错误)? - How to set up react and nodeJS on your local machine(npm error)? 本地机器上的下一个 JS 项目部署给出此错误 - Next JS project deployment on local machine giving this error Create-React-App:在本地机器上部署时出现 ESlint 错误 - Create-React-App: ESlint error while deployment on local machine 本地机器和 CodeSandbox 之间的 React 错误消息不同 - React error message is different between local machine and CodeSandbox 为什么远程库工作但本地库抛出错误? - Why remote library works but local library throws error? Typescript 使用useState更新本地state时出错 - Typescript error when updating local state using useState 从本地网络访问站点。 它将请求发送到localhost服务器,但是该服务器在为站点提供服务的计算机上 - Access site from local network. It sends requests to localhost server, but the server is on the machine, that serves the site
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM