mirror of
https://github.com/stablyai/orca.git
synced 2026-10-17 16:02:55 +00:00
Fix promisify overload typecheck error in windowsHide wrapper test
The wrapper's static type (...args: unknown[]) => unknown makes util.promisify resolve to its zero-arg callback overload, so calling the promisified function with args tripped TS2554 under typecheck. Type the promisified result to the variadic custom-symbol impl the wrapper copies at runtime. Co-authored-by: Orca <help@stably.ai>
This commit is contained in:
@@ -62,7 +62,11 @@ describe('wrapChildProcessApi', () => {
|
||||
}
|
||||
})
|
||||
const wrapped = wrapChildProcessApi(original)
|
||||
await expect(promisify(wrapped)('powershell.exe', ['-NoProfile'])).resolves.toBe('done')
|
||||
// The wrapper's static type is `(...args: unknown[]) => unknown`, which
|
||||
// makes promisify pick its zero-arg callback overload; the custom-symbol
|
||||
// impl copied at runtime is variadic, so type the result to match.
|
||||
const promisified = promisify(wrapped) as (...args: unknown[]) => Promise<unknown>
|
||||
await expect(promisified('powershell.exe', ['-NoProfile'])).resolves.toBe('done')
|
||||
expect(seen[2]).toEqual({ windowsHide: true })
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user