Skip to content

Commit

Permalink
Update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
theogravity committed Mar 22, 2020
1 parent 1d74add commit 317630a
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -429,9 +429,9 @@ await db.migrate({
})
```

### Typescript tricks
## Typescript tricks

#### Specify typings for a specific database driver
### Specify typings for a specific database driver

```typescript
import sqlite3 from 'sqlite3'
Expand All @@ -442,13 +442,13 @@ await open<sqlite3.Database, sqlite3.Statement>({
})
```

#### Use generics to get better typings on your rows
### Use generics to get better typings on your rows

Most methods allow for the use of [generics](https://www.typescriptlang.org/docs/handbook/generics.html)
to specify the data type of your returned data. This allows your IDE to perform better autocomplete
and the typescript compiler to perform better static type analysis.

##### Get example
#### Get example

```typescript

Expand All @@ -460,7 +460,7 @@ interface Row {
const result = await db.get<Row>('SELECT col FROM tbl WHERE col = ?', 'test')
```

##### All example
#### All example

```typescript
interface Row {
Expand Down

0 comments on commit 317630a

Please sign in to comment.