This commit is contained in:
Timo Hocker 2020-05-18 11:03:49 +02:00
parent 2c8ad31ff0
commit cee181caeb
2 changed files with 6 additions and 1 deletions

View File

@ -17,7 +17,8 @@ const { InteractiveOptions } = require ('./dist/lib/index.js');
{ name: 'str', type: 'string', env: 'TEST_STR' },
{ name: 'bool', type: 'boolean', env: 'TEST_BOOL' },
{ name: 'num', type: 'number', env: 'TEST_NUM' },
{ name: 'arr', type: 'array', env: 'TEST_ARR' }
{ name: 'arr', type: 'array', env: 'TEST_ARR' },
{ name: 'fld', type: 'folder', env: 'TEST_FOLDER' }
]);
await reader.parse ();
console.log (reader.serialize (true));

View File

@ -13,6 +13,10 @@ export class PathType extends TypeValidation {
return 'string';
}
public get persistent_type (): 'string'|'number'|'boolean'|'array' {
return 'string';
}
public async to_type (value: unknown): Promise<unknown> {
if (typeof value !== 'string')
throw new Error (`invalid type for ${this.option_type}`);