mirror of
https://github.com/knex/knex.git
synced 2026-01-04 02:57:58 +00:00
Make types documentation more explicit
This commit is contained in:
parent
aa7121fa98
commit
8c2a25213b
18
UPGRADING.md
18
UPGRADING.md
@ -3,7 +3,7 @@
|
||||
### Upgrading to version 0.95.0+
|
||||
|
||||
* TypeScript type exports changed significantly. While `import Knex from 'knex';` used to import the knex instantiation function, the namespace and the interface for the knex instantiation function/object, there is now a clear distinction between them:
|
||||
```
|
||||
```typescript
|
||||
import { knex } from 'knex' // this is a function that you call to instantiate knex
|
||||
import { Knex } from 'knex' // this is a namespace, and a type of a knex object
|
||||
import KnexTimeoutError = Knex.KnexTimeoutError; // this is a class from the Knex namespace
|
||||
@ -12,6 +12,22 @@ const config: Knex.Config = {} // this is a type from the Knex namespace
|
||||
const knexInstance: Knex = knex(config)
|
||||
```
|
||||
|
||||
If your code looked like this:
|
||||
```typescript
|
||||
import knex from 'knex'
|
||||
|
||||
const config: knex.Config = {} // this is a type from the Knex namespace
|
||||
const knexInstance = knex(config)
|
||||
```
|
||||
|
||||
Change it to
|
||||
```typescript
|
||||
import { knex, Knex } from 'knex'
|
||||
|
||||
const config: Knex.Config = {} // this is a type from the Knex namespace
|
||||
const knexInstance = knex(config)
|
||||
```
|
||||
|
||||
* TypeScript version 4.1+ is needed when using knex types now.
|
||||
|
||||
* MSSQL driver was completely reworked in order to address the multitude of connection pool, error handling and performance issues. Since the new implementation uses `tedious` library directly instead of `mssql`, please replace `mssql` with `tedious` in your dependencies if you are using a MSSQL database.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user