@@ -22,8 +22,6 @@ export interface PromptOptions<Self extends Prompt> {
2222 signal ?: AbortSignal ;
2323}
2424
25- export type State = 'initial' | 'active' | 'cancel' | 'submit' | 'error' ;
26-
2725export type LineOption = 'firstLine' | 'newLine' | 'lastLine' ;
2826
2927export interface FormatLineOptions {
@@ -338,8 +336,8 @@ export default class Prompt {
338336 ) : NonNullable < FormatOptions [ TLine ] [ TKey ] > => {
339337 return (
340338 key === 'style'
341- ? options ?. [ line ] ?. [ key ] ?? options ?. default ?. [ key ] ?? ( ( line ) => line )
342- : options ?. [ line ] ?. [ key ] ?? options ?. [ line ] ?. sides ?? options ?. default ?. [ key ] ?? ''
339+ ? ( options ?. [ line ] ?. [ key ] ?? options ?. default ?. [ key ] ?? ( ( line ) => line ) )
340+ : ( options ?. [ line ] ?. [ key ] ?? options ?. [ line ] ?. sides ?? options ?. default ?. [ key ] ?? '' )
343341 ) as NonNullable < FormatOptions [ TLine ] [ TKey ] > ;
344342 } ;
345343 const getLineOptions = ( line : LineOption ) : Omit < FormatLineOptions , 'sides' > => {
@@ -401,14 +399,14 @@ export default class Prompt {
401399 ) : FormatLineOptions [ TPosition ] => {
402400 return (
403401 i === 0 && ar . length === 1
404- ? options ?. firstLine ?. [ position ] ??
405- options ?. lastLine ?. [ position ] ??
406- firstLine [ position ]
402+ ? ( options ?. firstLine ?. [ position ] ??
403+ options ?. lastLine ?. [ position ] ??
404+ firstLine [ position ] )
407405 : i === 0
408- ? firstLine [ position ]
409- : i + 1 === ar . length
410- ? lastLine [ position ]
411- : newLine [ position ]
406+ ? firstLine [ position ]
407+ : i + 1 === ar . length
408+ ? lastLine [ position ]
409+ : newLine [ position ]
412410 ) as FormatLineOptions [ TPosition ] ;
413411 } ;
414412 const startLine = opt ( 'start' ) ;
@@ -426,9 +424,10 @@ export default class Prompt {
426424 . join ( '\n' ) ;
427425 }
428426
429- private _prevFrame = '' ;
430427 private render ( ) {
431- const frame = wrap ( this . _render ( this ) ?? '' , process . stdout . columns , { hard : true } ) ;
428+ const frame = wrap ( this . _render ( this ) ?? '' , process . stdout . columns , {
429+ hard : true ,
430+ } ) ;
432431 if ( frame === this . _prevFrame ) return ;
433432
434433 if ( this . state === 'initial' ) {
0 commit comments