Skip to content

Commit

Permalink
fix(jest-dev-server): fix config types (#573)
Browse files Browse the repository at this point in the history
Fix #572
  • Loading branch information
gregberge authored Dec 6, 2023
1 parent ae9245f commit 1508009
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions packages/jest-dev-server/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export type Config = {
* Action to take if the port is already used.
* @default "ask"
*/
usedPortAction?: "ask" | "error" | "ignore";
usedPortAction?: "ask" | "error" | "ignore" | "kill";
/**
* Options to pass to [`wait-on`](https://www.npmjs.com/package/wait-on).
* @see https://www.npmjs.com/package/wait-on#options
Expand Down Expand Up @@ -170,7 +170,10 @@ const checkIsPortBusy = async (config: Config): Promise<boolean> => {

type UsedPortHandler = (port: number) => boolean | Promise<boolean>;

const usedPortHandlers: Record<string, UsedPortHandler> = {
const usedPortHandlers: Record<
NonNullable<Config["usedPortAction"]>,
UsedPortHandler
> = {
error: (port) => {
throw new JestDevServerError(`Port ${port} is in use`, {
code: ERROR_PORT_USED,
Expand Down

0 comments on commit 1508009

Please sign in to comment.