Skip to content

Typing Issue with ffi.Library in fork Versions > 4.0.6 #3

@True-Aurel

Description

@True-Aurel

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions