From 5fc97a026e331c60c5e382249373f898262e04f0 Mon Sep 17 00:00:00 2001 From: AlejandroHerr Date: Sat, 15 Dec 2018 01:46:49 +0100 Subject: [PATCH] perf(I2cBus): Improve types --- src/lib/createI2cBusMock.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/lib/createI2cBusMock.ts b/src/lib/createI2cBusMock.ts index 65c3a28..dad694a 100644 --- a/src/lib/createI2cBusMock.ts +++ b/src/lib/createI2cBusMock.ts @@ -1,4 +1,4 @@ -import { BufferCallback, CompletionCallback, I2cBus, I2cBusFuncs, ResultCallback } from 'i2c-bus'; +import { BufferCallback, CompletionCallback, I2cBus, I2cBusFuncs, open, ResultCallback } from 'i2c-bus'; const defaultI2cBusFuncs = { i2c: false, @@ -21,13 +21,13 @@ const defaultI2cBusFuncs = { }; // @TODO Add full features -export default ({ +const createI2cBusMock = ({ devices = {}, i2cBusFuncs = defaultI2cBusFuncs, }: { devices?: { [address: number]: Buffer }; i2cBusFuncs?: I2cBusFuncs; -} = {}) => (_: number, openCallback: CompletionCallback): I2cBus => { +} = {}): typeof open => (_: number, openCallback: CompletionCallback): I2cBus => { openCallback(null); return { @@ -120,3 +120,5 @@ export default ({ }, }; }; + +export default createI2cBusMock;