[英]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.