I encountered a typing issue when upgrading from version 4.0.6 to newer versions. It seems that ffi.Library is being interpreted as the interface from @2060.io/ffi-napi/types/index.d.ts, rather than as the constructor function from @2060.io/ffi-napi/lib/library.js
Steps to Reproduce
Install @2060.io/ffi-napi version >=4.0.7.
Use the following code snippet:
import * as ffi from '@2060.io/ffi-napi';
private libSusi4: ffi.Library;
constructor() {
this.libSusi4 = ffi.Library(this.staticConf.libSusiFile, MioLibConf.LIB_SUSI_CONF);
}
To fix this issue, I manually imported the constructor function as follows:
import { Library as LibraryConstructor } from '@2060.io/ffi-napi/lib/library.js';
import * as ffi from '@2060.io/ffi-napi';
private libSusi4: LibraryConstructor;
constructor() {
this.libSusi4 = LibraryConstructor(this.staticConf.libSusiFile, MioLibConf.LIB_SUSI_CONF);
}
I'm using node 22.
Thanks in advance!
I encountered a typing issue when upgrading from version 4.0.6 to newer versions. It seems that ffi.Library is being interpreted as the interface from @2060.io/ffi-napi/types/index.d.ts, rather than as the constructor function from @2060.io/ffi-napi/lib/library.js
Steps to Reproduce
Install @2060.io/ffi-napi version >=4.0.7.
Use the following code snippet:
To fix this issue, I manually imported the constructor function as follows:
I'm using node 22.
Thanks in advance!