asg017 / sqlite-vss

A SQLite extension for efficient vector search, based on Faiss!
MIT License
1.59k stars 59 forks source link

Could not find a declaration file for module 'sqlite-vss'. #41

Closed linonetwo closed 1 year ago

linonetwo commented 1 year ago

Seems this is written in typescript, but not bundle .d.ts file within npm package? Can you include it?

Thanks in advance.

linonetwo commented 1 year ago

This may work:

declare module 'sqlite-vss' {
  export interface Database {
    // after https://deno.land/x/sqlite3@0.8.0/mod.ts?s=Database#method_loadExtension_0
    loadExtension(file: string, entrypoint?: string | undefined): void;
  }

  /**
   * Loads the sqlite-vss extension on the given sqlite3 database.
   */
  export function loadVector(database: Database): void;
  /**
   * Loads the sqlite-vss extension on the given sqlite3 database.
   */
  export function loadVss(database: Database): void;

  /**
   * Loads the sqlite-vss extension on the given sqlite3 database.
   */
  export function load(database: Database): void;
}
asg017 commented 1 year ago

Hey @linonetwo , v0.1.1-alpha.9 just published with the .d.ts types you added - can you give it a try and lmk if it works as expected?

linonetwo commented 1 year ago

Yes it works, thanks for rapid update.

linonetwo commented 1 year ago

I was on Windows PC last few days, back on Mac today.

linonetwo commented 1 year ago

Sorry, but the .d.ts file isn't publish to npm, maybe we need to change

https://github.com/asg017/sqlite-vss/blob/ca4aeb318ddc213504cabe6732735b6c7e3a21cc/bindings/node/sqlite-vss/package.json.tmpl#L18-L22

to add it. But should I also add index.js too?

asg017 commented 1 year ago

@linonetwo v0.1.1-alpha.17 now includes the .d.ts file in files, can you give it a shot?

linonetwo commented 1 year ago

Thanks, this works 截屏2023-06-07 11 27 10

linonetwo commented 1 year ago

Sorry but I finally decided to copy code and managed in my codebase, because the path from loadablePathResolver maybe incorrect after electron app packaged. (It will be .webpack/main/index.js in other folder instead of in node_modules folder.)

linonetwo commented 1 year ago

I'm trying to add this to https://github.com/tiddly-gittly/TidGi-Desktop , to provide note search. Thank you for your library!