我正在使用 TypeScript 学习 Jest,但遇到以下类型错误:
Property 'mockImplementation' does not exist on type '() => Element'.
Run Code Online (Sandbox Code Playgroud)
代码:
Property 'mockImplementation' does not exist on type '() => Element'.
Run Code Online (Sandbox Code Playgroud)
我尝试过强制转换any,但这似乎无法解决问题:
Home.mockImplementation((): any => <div>HomePageMock</div>)
Run Code Online (Sandbox Code Playgroud)
有任何想法吗?
TIA
我试图Controller按照文档(https://react-hook-form.com/get-started#IntegratingControlledInputs)使用包装器组件将 React Select 包装在 React Hook Form 内
<Controller
name="ShiftCaptain"
control={control}
render={({ field }) => (
<Select
{...field}
value={selectValue}
options={options}
placeholder={"Select Person"}
onChange={(e) => setSelectValue(e)}
/>
)}
/>
Run Code Online (Sandbox Code Playgroud)
提交表单时,React Select 中捕获的值不会填充到 React Hook Forms 中:

有任何想法吗?
TIA
我试图将第三列包含到现有的 SQL Server 查询中,但我得到了重复的结果值。
以下是 中包含的数据的示例tb_IssuedPermits:
| EmployeeName | Current |
|--------------|---------|
| Person A | 0 |
| Person A | 0 |
| Person B | 1 |
| Person C | 0 |
| Person B | 0 |
| Person A | 1 |
Run Code Online (Sandbox Code Playgroud)
这是我当前的查询,它根据 1 或 0 位值生成重复值。
| EmployeeName | Current |
|--------------|---------|
| Person A | 0 |
| Person A | 0 |
| Person B | 1 |
| …Run Code Online (Sandbox Code Playgroud)