Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing getAsync TypeScript Definition #304

Open
shtse8 opened this issue Sep 6, 2024 · 1 comment
Open

Missing getAsync TypeScript Definition #304

shtse8 opened this issue Sep 6, 2024 · 1 comment

Comments

@shtse8
Copy link

shtse8 commented Sep 6, 2024

Description:

The TypeScript definitions for lmdb appear to be missing the getAsync method, which exists in the JavaScript version. This results in TypeScript users not being able to use getAsync with proper type safety or autocompletion support.

Steps to Reproduce:

  1. Install the latest version of lmdb:

    npm install lmdb
  2. Use the getAsync method in a TypeScript file:

    import { open } from 'lmdb';
    
    const db = open({ path: './testdb' });
    
    async function fetchData() {
      const value = await db.getAsync('some-key');
      console.log(value);
    }
    
    fetchData();
  3. The TypeScript compiler throws an error:

    Property 'getAsync' does not exist on type 'Database'.
    

Expected Behavior:

The getAsync method should be defined in the TypeScript type definitions so that it can be used without errors in TypeScript projects.

Current Workaround:

Currently, I'm working around this issue by casting the database object or using a //@ts-ignore comment, but this is not ideal for maintaining type safety.

Environment:

  • lmdb version: [latest]
  • TypeScript version: [latest]

Suggested Fix:

Add getAsync to the TypeScript definitions of lmdb to match the JavaScript API.

Thank you for maintaining this project! I look forward to the resolution of this issue.

@kriszyp
Copy link
Owner

kriszyp commented Sep 17, 2024

Addressed in v3.1.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants