Skip to content

Commit a9c4ce4

Browse files
authored
docs: add TypeScript module augmentation help (#531)
1 parent 67306e9 commit a9c4ce4

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/guide/index.md

+11
Original file line numberDiff line numberDiff line change
@@ -589,3 +589,14 @@ declare module 'knex/types/tables' {
589589
}
590590
}
591591
```
592+
593+
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:
594+
595+
```ts
596+
// The trailing `.js` is required by the TypeScript compiler in certain configs:
597+
declare module 'knex/types/tables.js' { // <----- Different module path!!!
598+
interface Tables {
599+
// ...
600+
}
601+
}
602+
```

0 commit comments

Comments
 (0)