File tree Expand file tree Collapse file tree 11 files changed +44
-29
lines changed
Expand file tree Collapse file tree 11 files changed +44
-29
lines changed Original file line number Diff line number Diff line change 1- import { defineBuildConfig } from 'unbuild' ;
1+ import { type BuildConfig , defineBuildConfig } from 'unbuild' ;
22
33// @see https://github.com/unjs/unbuild
4- export default defineBuildConfig ( {
4+ const config : BuildConfig [ ] = defineBuildConfig ( {
55 preset : '../../build.preset' ,
66 entries : [ 'src/index' ] ,
77} ) ;
8+
9+ export default config ;
Original file line number Diff line number Diff line change @@ -7,7 +7,7 @@ interface ConfirmOptions extends PromptOptions<ConfirmPrompt> {
77 initialValue ?: boolean ;
88}
99export default class ConfirmPrompt extends Prompt {
10- get cursor ( ) {
10+ get cursor ( ) : 0 | 1 {
1111 return this . value ? 0 : 1 ;
1212 }
1313
Original file line number Diff line number Diff line change @@ -15,7 +15,7 @@ export default class GroupMultiSelectPrompt<T extends { value: any }> extends Pr
1515 return this . options . filter ( ( o ) => o . group === group ) ;
1616 }
1717
18- isGroupSelected ( group : string ) {
18+ isGroupSelected ( group : string ) : boolean {
1919 const items = this . getGroupItems ( group ) ;
2020 return items . every ( ( i ) => this . value . includes ( i . value ) ) ;
2121 }
Original file line number Diff line number Diff line change @@ -7,10 +7,10 @@ interface PasswordOptions extends PromptOptions<PasswordPrompt> {
77export default class PasswordPrompt extends Prompt {
88 valueWithCursor = '' ;
99 private _mask = '•' ;
10- get cursor ( ) {
10+ get cursor ( ) : number {
1111 return this . _cursor ;
1212 }
13- get masked ( ) {
13+ get masked ( ) : string {
1414 return this . value . replaceAll ( / ./ g, this . _mask ) ;
1515 }
1616 constructor ( { mask, ...opts } : PasswordOptions ) {
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ export interface TextOptions extends PromptOptions<TextPrompt> {
88
99export default class TextPrompt extends Prompt {
1010 valueWithCursor = '' ;
11- get cursor ( ) {
11+ get cursor ( ) : number {
1212 return this . _cursor ;
1313 }
1414 constructor ( opts : TextOptions ) {
Original file line number Diff line number Diff line change @@ -10,13 +10,13 @@ export * from './settings';
1010
1111const isWindows = globalThis . process . platform . startsWith ( 'win' ) ;
1212
13- export const CANCEL_SYMBOL = Symbol ( 'clack:cancel' ) ;
13+ export const CANCEL_SYMBOL : symbol = Symbol ( 'clack:cancel' ) ;
1414
1515export function isCancel ( value : unknown ) : value is symbol {
1616 return value === CANCEL_SYMBOL ;
1717}
1818
19- export function setRawMode ( input : Readable , value : boolean ) {
19+ export function setRawMode ( input : Readable , value : boolean ) : void {
2020 const i = input as typeof stdin ;
2121
2222 if ( i . isTTY ) i . setRawMode ( value ) ;
@@ -27,6 +27,11 @@ export function block({
2727 output = stdout ,
2828 overwrite = true ,
2929 hideCursor = true ,
30+ } : {
31+ input ?: NodeJS . ReadStream ;
32+ output ?: NodeJS . WriteStream ;
33+ overwrite ?: boolean ;
34+ hideCursor ?: boolean ;
3035} = { } ) {
3136 const rl = readline . createInterface ( {
3237 input,
@@ -57,7 +62,7 @@ export function block({
5762 if ( hideCursor ) output . write ( cursor . hide ) ;
5863 input . once ( 'keypress' , clear ) ;
5964
60- return ( ) => {
65+ return ( ) : void => {
6166 input . off ( 'keypress' , clear ) ;
6267 if ( hideCursor ) output . write ( cursor . show ) ;
6368
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ export interface ClackSettings {
3232 aliases : Record < string , Action > ;
3333}
3434
35- export function updateSettings ( updates : ClackSettings ) {
35+ export function updateSettings ( updates : ClackSettings ) : void {
3636 for ( const _key in updates ) {
3737 const key = _key as keyof ClackSettings ;
3838 if ( ! Object . hasOwn ( updates , key ) ) continue ;
@@ -58,7 +58,7 @@ export function updateSettings(updates: ClackSettings) {
5858 * @param action - The action to match
5959 * @returns boolean
6060 */
61- export function isActionKey ( key : string | Array < string | undefined > , action : Action ) {
61+ export function isActionKey ( key : string | Array < string | undefined > , action : Action ) : boolean {
6262 if ( typeof key === 'string' ) {
6363 return settings . aliases . get ( key ) === action ;
6464 }
Original file line number Diff line number Diff line change 1- export function diffLines ( a : string , b : string ) {
1+ export function diffLines ( a : string , b : string ) : number [ ] | undefined {
22 if ( a === b ) return ;
33
44 const aLines = a . split ( '\n' ) ;
Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ import { Readable } from 'node:stream';
33export class MockReadable extends Readable {
44 protected _buffer : unknown [ ] | null = [ ] ;
55
6- _read ( ) {
6+ _read ( ) : void {
77 if ( this . _buffer === null ) {
88 this . push ( null ) ;
99 return ;
Original file line number Diff line number Diff line change 1- import { defineBuildConfig } from 'unbuild' ;
1+ import { type BuildConfig , defineBuildConfig } from 'unbuild' ;
22
3- export default defineBuildConfig ( {
3+ const config : BuildConfig [ ] = defineBuildConfig ( {
44 preset : '../../build.preset' ,
55 entries : [ 'src/index' ] ,
66} ) ;
7+
8+ export default config ;
You can’t perform that action at this time.
0 commit comments