Skip to content

Commit 382b475

Browse files
authored
fix: add symbol type to decorators, also tests (#170)
1 parent 508aede commit 382b475

File tree

2 files changed

+11
-9
lines changed

2 files changed

+11
-9
lines changed

plugin.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ export interface PluginMetadata {
2424
name?: string,
2525
/** Decorator dependencies for this plugin */
2626
decorators?: {
27-
fastify?: string[],
28-
reply?: string[],
29-
request?: string[]
27+
fastify?: (string | symbol)[],
28+
reply?: (string | symbol)[],
29+
request?: (string | symbol)[]
3030
},
3131
/** The plugin dependencies */
3232
dependencies?: string[]

plugin.test-d.ts

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ interface Options {
66
foo: string
77
}
88

9+
const testSymbol = Symbol('foobar')
10+
911
// Callback
1012

1113
const pluginCallback: FastifyPluginCallback = (fastify, options, next) => { }
@@ -21,9 +23,9 @@ expectAssignable<FastifyPluginCallback>(fp(pluginCallback, {
2123
fastify: '',
2224
name: '',
2325
decorators: {
24-
fastify: [ '' ],
25-
reply: [ '' ],
26-
request: [ '' ]
26+
fastify: [ '', testSymbol ],
27+
reply: [ '', testSymbol ],
28+
request: [ '', testSymbol ]
2729
},
2830
dependencies: [ '' ]
2931
}))
@@ -48,9 +50,9 @@ expectAssignable<FastifyPluginAsync>(fp(pluginAsync, {
4850
fastify: '',
4951
name: '',
5052
decorators: {
51-
fastify: [ '' ],
52-
reply: [ '' ],
53-
request: [ '' ]
53+
fastify: [ '', testSymbol ],
54+
reply: [ '', testSymbol ],
55+
request: [ '', testSymbol ]
5456
},
5557
dependencies: [ '' ]
5658
}))

0 commit comments

Comments
 (0)