Open joerick opened 1 month ago
Thank you for making this package! On installing I couldn't get typescript to find type definitions (though I do see they're there in comment form).
Anyway, if others have this issue, I wrote these definitions which are working well for me.
Put into a types.d.ts file in your project.
types.d.ts
declare module 'spl.js' { export interface ResultSync { first: any; flat: any[]; rows: any[]; cols: string[]; objs: {}[]; } export interface Result { first: Promise<any>; flat: Promise<any[]>; rows: Promise<any[]>; cols: Promise<string[]>; objs: Promise<{}[]>; sync: Promise<ResultSync>; free: Promise<void>; } export interface MountOptions { name: string; data: ArrayBuffer | Blob | File | FileList | string; } export interface AutoGeoJSON { precision: number; options: 0 | 1 | 2 | 3 | 4 | 5; } export interface Extension { extends: 'db' | 'spl'; fns: { [name: string]: Function }; } export interface SPLOptions { autoJSON: boolean; autoGeoJSON: AutoGeoJSON; } export interface DB { attach(db: string, schema: string): DB; detach(schema: string): DB; exec(sql: string, parameters?: any[] | { [name: string]: any }): DB; read(sql: string): DB; load(src: string): DB; save(dest?: string): DB; close(): SPLInstance; get: Result; } export interface SPLInstance { db(path?: string | ArrayBuffer): DB; mount(path: string, options: MountOptions[]): SPLInstance; unmount(path: string): SPLInstance; version(): Promise<any>; } export default function ( options?: SPLOptions, extensions?: Extension[] ): Promise<SPLInstance>; }
Thank you for sharing @joerick !
Thank you for making this package! On installing I couldn't get typescript to find type definitions (though I do see they're there in comment form).
Anyway, if others have this issue, I wrote these definitions which are working well for me.
Put into a
types.d.ts
file in your project.