@@ -9,7 +9,7 @@ import type { TrueFalse } from './utils.js';
99 */
1010type InlineWorkflowCommand = 'error' | 'warning' | 'none' ;
1111
12- export type ActionParamsInput = Record < keyof ActionParams , string > ;
12+ export type ActionParamsInput = Record < keyof ActionParams , string | undefined > ;
1313
1414export interface ActionParams {
1515 /**
@@ -69,7 +69,7 @@ export interface ActionParams {
6969 * 'simple' - only unknown words are reported.
7070 * 'typos' - only typos are reported.
7171 * 'flagged' - only flagged words are reported.
72- * @ default 'all'
72+ * default: use default reporting.
7373 */
7474 report : ReportChoices ;
7575}
@@ -86,7 +86,7 @@ const defaultActionParams: ActionParams = {
8686 check_dot_files : 'explicit' ,
8787 use_cspell_files : 'false' ,
8888 suggestions : 'false' ,
89- report : 'all' ,
89+ report : undefined ,
9090} ;
9191
9292type ValidationFunction = ( params : ActionParamsInput ) => string | undefined ;
@@ -116,7 +116,11 @@ function validateTrueFalse(key: keyof ActionParamsInput): ValidationFunction {
116116 return validateOptions ( key , [ 'true' , 'false' ] ) ;
117117}
118118
119- function validateOptions ( key : keyof ActionParamsInput , options : string [ ] , optional ?: boolean ) : ValidationFunction {
119+ function validateOptions < K extends keyof ActionParamsInput > (
120+ key : K ,
121+ options : ActionParamsInput [ K ] [ ] ,
122+ optional ?: boolean ,
123+ ) : ValidationFunction {
120124 return ( params : ActionParamsInput ) => {
121125 const value = params [ key ] ;
122126 if ( optional && ! value ) {
@@ -148,7 +152,7 @@ export function validateActionParams(
148152 validateTrueFalse ( 'use_cspell_files' ) ,
149153 validateTrueFalse ( 'suggestions' ) ,
150154 validateOptions ( 'check_dot_files' , [ 'true' , 'false' , 'explicit' ] ) ,
151- validateOptions ( 'report' , [ 'all' , 'simple' , 'typos' , 'flagged' ] ) ,
155+ validateOptions ( 'report' , [ 'all' , 'simple' , 'typos' , 'flagged' ] , true ) ,
152156 ] ;
153157 const success = validations
154158 . map ( ( fn ) => fn ( params ) )
0 commit comments