@@ -118,18 +118,18 @@ export const port: Parser<number> = serializedValue => {
118118 * a list of whitelisted values.
119119 */
120120export function whitelist < TValue extends string > (
121- whitelistedValues : ReadonlyArray < TValue > ,
121+ whitelistedValues : readonly TValue [ ] ,
122122) : Parser < TValue > {
123123 const whitelistParser : Parser < TValue > = serializedValue => {
124124 const value = serializedValue ;
125125
126- if ( ! ( whitelistedValues as ReadonlyArray < string > ) . includes ( value ) ) {
127- const whitelistedValuesStr = whitelistedValues
126+ if ( ! ( whitelistedValues as readonly string [ ] ) . includes ( value ) ) {
127+ const whitelistedValuesString = whitelistedValues
128128 . map ( whitelistedValue => `'${ whitelistedValue } '` )
129129 . join ( ', ' ) ;
130130
131131 throw new EnvironmentVariableError (
132- `value is not in the whitelist. Valid values are ${ whitelistedValuesStr } ` ,
132+ `value is not in the whitelist. Valid values are ${ whitelistedValuesString } ` ,
133133 ) ;
134134 }
135135
@@ -143,7 +143,7 @@ export function whitelist<TValue extends string>(
143143 * Returns a parser that parses a value matching a regular expression.
144144 */
145145export function regex ( pattern : RegExp ) : Parser < string > {
146- const whitelistParser : Parser < string > = serializedValue => {
146+ const regexParser : Parser < string > = serializedValue => {
147147 const value = serializedValue ;
148148
149149 if ( ! pattern . test ( value ) ) {
@@ -155,7 +155,7 @@ export function regex(pattern: RegExp): Parser<string> {
155155 return value ;
156156 } ;
157157
158- return whitelistParser ;
158+ return regexParser ;
159159}
160160
161161export type ArrayParserArgs < TType > = Readonly < {
@@ -170,10 +170,10 @@ const defaultArraySeparator = ',';
170170 */
171171export function array < TType > (
172172 args : ArrayParserArgs < TType > ,
173- ) : Parser < ReadonlyArray < TType > > {
173+ ) : Parser < readonly TType [ ] > {
174174 const separator = args . separator || defaultArraySeparator ;
175175
176- const arrayParser : Parser < ReadonlyArray < TType > > = serializedArray => {
176+ const arrayParser : Parser < readonly TType [ ] > = serializedArray => {
177177 const serializedValues = serializedArray . split ( separator ) ;
178178
179179 const values = serializedValues . map ( args . parser ) ;
0 commit comments