diff --git a/deno.ts b/deno.ts index a94e49f..e0108d4 100644 --- a/deno.ts +++ b/deno.ts @@ -3,7 +3,7 @@ import { cliui, UI } from './build/lib/index.js' import type { UIOptions } from './build/lib/index.d.ts' import { wrap, stripAnsi } from './build/lib/string-utils.js' -export default function ui (opts: UIOptions): UI { +export default function ui (opts?: UIOptions): UI { return cliui(opts, { stringWidth: (str: string) => { return [...str].length diff --git a/lib/cjs.ts b/lib/cjs.ts index bda4241..dbe2ef3 100644 --- a/lib/cjs.ts +++ b/lib/cjs.ts @@ -3,7 +3,7 @@ import { cliui, UIOptions } from './index.js' const stringWidth = require('string-width') const stripAnsi = require('strip-ansi') const wrap = require('wrap-ansi') -export default function ui (opts: UIOptions) { +export default function ui (opts?: UIOptions) { return cliui(opts, { stringWidth, stripAnsi, diff --git a/lib/index.ts b/lib/index.ts index 0673c3a..b082b2a 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -380,7 +380,7 @@ function alignCenter (str: string, width: number): string { } let mixin: Mixin -export function cliui (opts: Partial, _mixin: Mixin) { +export function cliui (opts: Partial | undefined | null, _mixin: Mixin) { mixin = _mixin return new UI({ width: opts?.width || getWindowWidth(),