Skip to content

Commit

Permalink
type developMiddleware arg as express app to avoid any
Browse files Browse the repository at this point in the history
  • Loading branch information
pieh committed May 19, 2020
1 parent ba4c300 commit 6b064a0
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions packages/gatsby/src/utils/merge-gatsby-config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import _ from "lodash"
import { Express } from "express"
// TODO export it in index.d.ts
type PluginEntry =
| string
Expand All @@ -7,7 +8,6 @@ type PluginEntry =
options?: Record<string, unknown>
}


interface INormalizedPluginEntry {
resolve: string
options: Record<string, unknown>
Expand All @@ -24,7 +24,7 @@ interface IGatsbyConfigInput {
prefix: string
url: string
}
developMiddleware?(app: any): void
developMiddleware?(app: Express): void
}

type ConfigKey = keyof IGatsbyConfigInput
Expand All @@ -40,7 +40,10 @@ type Mapping = IGatsbyConfigInput["mapping"]
*/
const normalizePluginEntry = (entry: PluginEntry): INormalizedPluginEntry =>
_.isString(entry)
? { resolve: entry, options: {} }
? {
resolve: entry,
options: {},
}
: _.isObject(entry)
? { options: {}, ...entry }
: entry
Expand Down

0 comments on commit 6b064a0

Please sign in to comment.