Skip to content

Commit

Permalink
fix: improve type generation
Browse files Browse the repository at this point in the history
  • Loading branch information
elribonazo committed Jan 1, 2025
1 parent 09d4d7f commit b5dcc14
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/ridb-level/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"test:node": "sh test.sh -e node",
"test:browser": "sh test.sh -e browser",
"types": "npm run types:default",
"types:default": "npx dts-bundle-generator src/index.ts --no-check -o ./build/index.d.ts",
"types:default": "npx tsc",
"prepublishOnly": "npm run build"
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/ridb-level/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import type {
Doc,
Operation,
QueryType,
BaseStorage as BaseStorageWasm
} from "@trust0/ridb-wasm";
import type { BaseStorage as BaseStorageWasm} from "@trust0/ridb-wasm";
import type { ClassicLevel } from "classic-level";
type Level = ClassicLevel<string, string>

Expand Down
3 changes: 1 addition & 2 deletions packages/ridb-level/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,7 @@
"lib": ["ES2022", "DOM"]
},
"include": [
"src/**/*",
"../testing/src/**/*"
"src/**/*"
],
"exclude": ["node_modules", "build"]
}
8 changes: 5 additions & 3 deletions packages/ridb-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,11 @@
},
"scripts": {
"clean": "rm -rf build node_modules",
"ts-types": " tsc ",
"build": "rm -rf build && node ./esbuild.js && npm run ts-types",
"test": "vitest --run"
"build": "rm -rf build && npm run types && node ./esbuild.js",
"test": "vitest --run",
"types": "npm run types:default",
"types:default": "npx tsc",
"prepublishOnly": "npm run build"
},
"files": [
"build/*",
Expand Down
4 changes: 2 additions & 2 deletions packages/ridb/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,10 @@ export class RIDB<T extends SchemaTypeRecord = SchemaTypeRecord> {

/**
* Loads the RIDB Rust module.
* @returns {Promise<typeof import("@trust0/ridb-wasm")>} A promise that resolves to the RIDB Rust module.
* @returns {Promise<typeof import("@trust0/ridb")>} A promise that resolves to the RIDB Rust module.
* @private
*/
static async load(): Promise<typeof import("@trust0/ridb-wasm")> {
static async load() {
internal ??= await import("@trust0/ridb-wasm").then(async (module) => {
const wasmInstance = module.initSync(wasmBuffer);
await module.default(wasmInstance);
Expand Down

0 comments on commit b5dcc14

Please sign in to comment.