You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
default and defaultDev should pass the validator like a normal value, then there's no reason to put something else than string.
Here's an example:
consttoArray=makeValidator((input: string): string[]=>{returninput.split(',')})interfaceIEnv{readonlyTEST: string[]}constenv: IEnv=cleanEnv(process.env,{TEST: toArray({default: 'test,string'})// Argument type {default: string} is not assignable to parameter type Spec<string[]> | undefined})constenv2: IEnv=cleanEnv(process.env,{TEST: toArray({default: ['test','string']})// input.split is not a function})
This make the library inconsistent, in fact env inputs are always string and we parse them to type them correctly, we cannot trust default values and have to check them like regular env input, then default and defaultDev must be type of string and nothing else.
The text was updated successfully, but these errors were encountered:
default
anddefaultDev
should pass the validator like a normal value, then there's no reason to put something else than string.Here's an example:
This make the library inconsistent, in fact env inputs are always string and we parse them to type them correctly, we cannot trust default values and have to check them like regular env input, then
default
anddefaultDev
must be type of string and nothing else.The text was updated successfully, but these errors were encountered: