Skip to content

Commit

Permalink
fix(types): use interface instead of type infering
Browse files Browse the repository at this point in the history
  • Loading branch information
pooya parsa committed Jun 1, 2020
1 parent 8b0eb23 commit 09135eb
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import { createServer, AddressInfo } from 'net'
import { getMemo, setMemo } from 'fs-memo'

const defaults = {
interface GetPortOptions {
ports: number[]
port: number
memoDir: string
memoName: string
}

const defaults: GetPortOptions = {
ports: [4000, 5000, 6000, 7000],
port: parseInt(process.env.PORT || '') || 3000,
memoDir: __dirname,
memoName: '.get-port'
}

type GetPortOptions = Partial<typeof defaults>

export default async function getPort (_options: GetPortOptions = {}): Promise<number> {
export default async function getPort (_options: Partial<GetPortOptions> = {}): Promise<number> {
const options = { ...defaults, _options }

const portsToCheck: number[] = []
Expand Down

0 comments on commit 09135eb

Please sign in to comment.