Skip to content

Commit 4a2c27d

Browse files
author
Oscar Franco
committed
Update readme on how to import types
1 parent 95a6e43 commit 4a2c27d

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

README.md

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,21 @@ interface ISQLite {
5454
insertId?: number;
5555
};
5656
}
57+
```
58+
59+
In your code
60+
61+
```typescript
62+
// If you want to register the (globalThis) types for the low level API do an empty import
63+
import 'react-native-quick-sqlite';
5764

5865
// `sqlite` is a globally registered object, so you can directly call it from anywhere in your javascript
5966
// The methods `throw` when an execution error happens, so try/catch them
60-
sqlite.open('myDatabase', 'databases');
67+
try {
68+
sqlite.open('myDatabase', 'databases');
69+
} catch (e) {
70+
console.log(e); // [react-native-quick-sqlite]: Could not open database file: ERR XXX
71+
}
6172
```
6273

6374
## License

0 commit comments

Comments
 (0)