Skip to content

Commit

Permalink
docs: add TypeScript module augmentation help (#531)
Browse files Browse the repository at this point in the history
  • Loading branch information
clavin committed Jul 18, 2023
1 parent 67306e9 commit a9c4ce4
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -589,3 +589,14 @@ declare module 'knex/types/tables' {
}
}
```

When TypeScript is configured to use a modern module resolution setting (`node16`, `nodenext`, etc.), the compiler expects that the declared module name ends with a `.js` file type. You will need to declare your inferred types as follows instead:

```ts
// The trailing `.js` is required by the TypeScript compiler in certain configs:
declare module 'knex/types/tables.js' { // <----- Different module path!!!
interface Tables {
// ...
}
}
```

0 comments on commit a9c4ce4

Please sign in to comment.