Skip to content

Commit 64d7c9a

Browse files
committed
Add declaration merging example
1 parent e7fa200 commit 64d7c9a

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/types/index.d.ts

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* eslint-disable @typescript-eslint/no-unused-vars */
2+
// Must have to let TSC knows we're merging the module 'fastify'
3+
import * as fastify from 'fastify';
4+
5+
// Using declaration merging, add your plugin props to the appropriate
6+
// fastify interfaces.
7+
declare module 'fastify' {
8+
interface FastifyInstance {
9+
exampleProperty: string; // replace this with your props
10+
}
11+
}

tsconfig.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,10 @@
1111
"strictNullChecks": true,
1212
"strictPropertyInitialization": true,
1313
"moduleResolution": "node",
14+
"typeRoots": [
15+
"./node_modules/@types",
16+
"./src/types"
17+
],
1418
"outDir": "dist",
1519
"baseUrl": ".",
1620
"paths": {

0 commit comments

Comments
 (0)