![](/img/trans.png)
[英]npm run build works fine on local machine but shows error on remote ubuntu server
[英]Typescript error on local machine but not on remote test server
我正在尝试使用 Microsoft Fabric 的 UI 工具。 这是我在本地机器上遇到的错误。
/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}
但是,当我将完全相同的代码加载到 codesandbox.io 时,错误消失并且工作正常。 我的文件是一样的,package.json是一样的。 是什么导致了这种行为?
示例: https://codesandbox.io/s/restless-darkness-xypss?file=/src/Search.tsx
更改后它也对我有用
"strict": false,
在 tsconfig.json
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.