Skip to content

Commit

Permalink
Callback of origin should be potentially undefined
Browse files Browse the repository at this point in the history
In reference to fastify#236 origin cannot be assumed to always be a string. Propose making it `string | undefined` to ensure people handle it correctly. This would flag quickly in the sync example on the README that new URL can't work with undefined.
  • Loading branch information
joshmeads authored Dec 14, 2022
1 parent 1b8950e commit d6ca3d0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ type FastifyCorsHook =
| 'onSend'

declare namespace fastifyCors {
export type OriginFunction = (origin: string, callback: OriginCallback) => void;
export type OriginFunction = (origin?: string, callback: OriginCallback) => void;

export interface FastifyCorsOptions {
/**
Expand Down

0 comments on commit d6ca3d0

Please sign in to comment.