Skip to content

Commit 3e45470

Browse files
authored
fix: wrong type when dotenv files get parsed by dotenv (#1293)
1 parent aaa619b commit 3e45470

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/argv.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,12 @@ export class Argv {
6161
for (const [key, value] of Object.entries(config)) {
6262
const argKey = camelCase(key);
6363
if (argv[argKey] == null) {
64-
this.map.set(argKey, value);
64+
// Work around `dotenv.parse` limitation https://github.com/motdotla/dotenv/issues/51#issuecomment-552559070
65+
if (value === "true") this.map.set(argKey, true);
66+
else if (value === "false") this.map.set(argKey, false);
67+
else if (value === "null") this.map.set(argKey, null);
68+
else if (!isNaN(Number(value))) this.map.set(argKey, Number(value));
69+
else this.map.set(argKey, value);
6570
}
6671
}
6772
}

0 commit comments

Comments
 (0)