@@ -20,8 +20,6 @@ export interface PromptOptions<Self extends Prompt> {
2020 debug ?: boolean ;
2121}
2222
23- export type State = 'initial' | 'active' | 'cancel' | 'submit' | 'error' ;
24-
2523export type LineOption = 'firstLine' | 'newLine' | 'lastLine' ;
2624
2725export interface FormatLineOptions {
@@ -313,8 +311,8 @@ export default class Prompt {
313311 ) : NonNullable < FormatOptions [ TLine ] [ TKey ] > => {
314312 return (
315313 key === 'style'
316- ? options ?. [ line ] ?. [ key ] ?? options ?. default ?. [ key ] ?? ( ( line ) => line )
317- : options ?. [ line ] ?. [ key ] ?? options ?. [ line ] ?. sides ?? options ?. default ?. [ key ] ?? ''
314+ ? ( options ?. [ line ] ?. [ key ] ?? options ?. default ?. [ key ] ?? ( ( line ) => line ) )
315+ : ( options ?. [ line ] ?. [ key ] ?? options ?. [ line ] ?. sides ?? options ?. default ?. [ key ] ?? '' )
318316 ) as NonNullable < FormatOptions [ TLine ] [ TKey ] > ;
319317 } ;
320318 const getLineOptions = ( line : LineOption ) : Omit < FormatLineOptions , 'sides' > => {
@@ -376,14 +374,14 @@ export default class Prompt {
376374 ) : FormatLineOptions [ TPosition ] => {
377375 return (
378376 i === 0 && ar . length === 1
379- ? options ?. firstLine ?. [ position ] ??
380- options ?. lastLine ?. [ position ] ??
381- firstLine [ position ]
377+ ? ( options ?. firstLine ?. [ position ] ??
378+ options ?. lastLine ?. [ position ] ??
379+ firstLine [ position ] )
382380 : i === 0
383- ? firstLine [ position ]
384- : i + 1 === ar . length
385- ? lastLine [ position ]
386- : newLine [ position ]
381+ ? firstLine [ position ]
382+ : i + 1 === ar . length
383+ ? lastLine [ position ]
384+ : newLine [ position ]
387385 ) as FormatLineOptions [ TPosition ] ;
388386 } ;
389387 const startLine = opt ( 'start' ) ;
@@ -401,9 +399,10 @@ export default class Prompt {
401399 . join ( '\n' ) ;
402400 }
403401
404- private _prevFrame = '' ;
405402 private render ( ) {
406- const frame = wrap ( this . _render ( this ) ?? '' , process . stdout . columns , { hard : true } ) ;
403+ const frame = wrap ( this . _render ( this ) ?? '' , process . stdout . columns , {
404+ hard : true ,
405+ } ) ;
407406 if ( frame === this . _prevFrame ) return ;
408407
409408 if ( this . state === 'initial' ) {
0 commit comments