Closed lirbank closed 1 year ago
Consider the following:
const storage = new IndexedDbTupleStorage("objectStoreName"); const db = new AsyncTupleDatabase(storage); const client = new AsyncTupleDatabaseClient<Schema>(db); function useStuff() { const r = useTupleDatabase<Schema, string, []>( client, // <-- AsyncTupleDatabaseClient<Schema> (client) => { // <-- TupleDatabaseClientApi<Schema> console.log(client); return "stuff"; }, [] ); console.log("r", r); return r }
Here TS will complain on the first argument to useTupleDatabase, since TupleDatabaseClient is expected but AsyncTupleDatabaseClient is provided.
useTupleDatabase
TupleDatabaseClient
AsyncTupleDatabaseClient
Never mind, I found it:
import { useAsyncTupleDatabase } from "tuple-database/useAsyncTupleDatabase";
Consider the following:
Here TS will complain on the first argument to
useTupleDatabase
, sinceTupleDatabaseClient
is expected butAsyncTupleDatabaseClient
is provided.