Skip to content

fix(types): allow undefined values in populate output - #1074

Merged
motdotla merged 1 commit into
motdotla:masterfrom
himanshu748:codex/fix-dotenv-populate-undefined-20261011
Oct 14, 2026
Merged

motdotla merged 1 commit into
motdotla:masterfrom
himanshu748:codex/fix-dotenv-populate-undefined-20261011

Conversation

@himanshu748

Copy link
Copy Markdown
Contributor

populate() accepts undefined input values and preserves them in its result, but DotenvPopulateOutput currently declares every value as string.
Change the output index signature to string | undefined. Add a strict TypeScript regression that rejects assigning an undefined-capable populated value to a required string, plus a runtime test documenting the existing behavior for empty and populated targets with override: true.
This is a declaration correction; the runtime implementation is unchanged. Consumers using strict null checks may need to narrow a populated value before treating it as a string.
Validation recorded in the 12 October 2026 handoff on Linux, Node 24.19.0 and npm 11.9.0:

  • The new type test fails against the original declaration with TS2578 and passes with the change.
  • The runtime control passes against the original implementation, confirming it already preserves undefined values.
  • npm test: build, Standard lint, strict TypeScript checks, and TAP passed; 1,203 passed and 1 skipped.
  • npm run test:perf: passed; fast/classic ratio 2.21x for Buffer input and 2.39x for string input, above the 1.5x gate.
    The Windows executable/batch-shim case was skipped on Linux. The full Ubuntu/Windows and Node 20/22/24/26 matrix was not run.
    AI assistance: Codex assisted with this contribution and regression validation.

@himanshu748
himanshu748 marked this pull request as ready for review October 12, 2026 08:12
@motdotla

Copy link
Copy Markdown
Owner

appreciate this but this is ai thinking... this is just not a real edge case in the history of .env files. no one uses proto as a key name. not worth the added complexity to support such a non-existent edge case.

@motdotla motdotla closed this Oct 14, 2026
@motdotla motdotla reopened this Oct 14, 2026
@motdotla

Copy link
Copy Markdown
Owner

oops that comment above was meant for a different PR. reviewing this one now.

@himanshu748

Copy link
Copy Markdown
Contributor Author

oops that comment above was meant for a different PR. reviewing this one now.

Lol🥲will wait.

@motdotla
motdotla merged commit 53405b0 into motdotla:master Oct 14, 2026
16 checks passed
@motdotla

Copy link
Copy Markdown
Owner

merged. thanks! will go out shortly as x.x.8

renovate Bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Oct 17, 2026
| datasource | package | from   | to     |
| ---------- | ------- | ------ | ------ |
| npm        | dotenv  | 18.0.7 | 18.0.8 |


## [v18.0.8](https://github.com/motdotla/dotenv/blob/HEAD/CHANGELOG.md#1808-2026-10-14)

##### Changed

- Fast parser should strip appended extra quotes ([#1073](motdotla/dotenv#1073))
- Type detail improvement ([#1074](motdotla/dotenv#1074))
OIRNOIR pushed a commit to OIRNOIR/YouTube-Helper-Server that referenced this pull request Oct 22, 2026
This PR contains the following updates:

| Package | Type | Update | Change |
|---|---|---|---|
| [dotenv](https://github.com/motdotla/dotenv) | imports | patch | [`18.0.7` -> `18.0.8`](https://renovatebot.com/diffs/npm/dotenv/18.0.7/18.0.8) |

---

### Release Notes

<details>
<summary>motdotla/dotenv (dotenv)</summary>

### [`v18.0.8`](https://github.com/motdotla/dotenv/blob/HEAD/CHANGELOG.md#1808-2026-10-14)

[Compare Source](motdotla/dotenv@v18.0.7...v18.0.8)

##### Changed

- Fast parser should strip appended extra quotes ([#&#8203;1073](motdotla/dotenv#1073))
- Type detail improvement ([#&#8203;1074](motdotla/dotenv#1074))

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - At any time (no schedule defined)
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xNjguMiIsInVwZGF0ZWRJblZlciI6IjQ0LjE2OC4yIiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->

Reviewed-on: https://git.oirnoir.dev/OIRNOIR/YouTube-Helper-Server/pulls/57
renovate Bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Oct 22, 2026
| datasource | package | from   | to     |
| ---------- | ------- | ------ | ------ |
| npm        | dotenv  | 18.0.7 | 18.0.8 |


## [v18.0.8](https://github.com/motdotla/dotenv/blob/HEAD/CHANGELOG.md#1808-2026-10-14)

##### Changed

- Fast parser should strip appended extra quotes ([#1073](motdotla/dotenv#1073))
- Type detail improvement ([#1074](motdotla/dotenv#1074))
markharding pushed a commit to futo-org/Harbor that referenced this pull request Oct 23, 2026
This PR contains the following updates:

| Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) |
|---|---|---|---|
| [dotenv](https://github.com/motdotla/dotenv) | [`^17.4.2` → `^18.0.0`](https://renovatebot.com/diffs/npm/dotenv/17.4.2/18.0.8) | ![age](https://developer.mend.io/api/mc/badges/age/npm/dotenv/18.0.8?slim=true) | ![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/dotenv/17.4.2/18.0.8?slim=true) |

---

> ⚠️ **Warning**
>
> Some dependencies could not be looked up. Check the [Dependency Dashboard](issues/99) for more information.

---

### Release Notes

<details>
<summary>motdotla/dotenv (dotenv)</summary>

### [`v18.0.8`](https://github.com/motdotla/dotenv/blob/HEAD/CHANGELOG.md#1808-2026-10-14)

[Compare Source](motdotla/dotenv@v18.0.7...v18.0.8)

##### Changed

- Fast parser should strip appended extra quotes ([#&#8203;1073](motdotla/dotenv#1073))
- Type detail improvement ([#&#8203;1074](motdotla/dotenv#1074))

### [`v18.0.7`](https://github.com/motdotla/dotenv/blob/HEAD/CHANGELOG.md#1807-2026-10-09)

[Compare Source](motdotla/dotenv@v18.0.6...v18.0.7)

##### Changed

- Treat undefined settings like `quiet: true` as null rather than falsey ([#&#8203;1070](motdotla/dotenv#1070))
- CLI should honor `DOTENV_QUIET` setting in `.env` file ([#&#8203;1071](motdotla/dotenv#1071))

### [`v18.0.6`](https://github.com/motdotla/dotenv/blob/HEAD/CHANGELOG.md#1806-2026-10-06)

[Compare Source](motdotla/dotenv@v18.0.5...v18.0.6)

##### Changed

- Use smarter `parseBoolean` not Boolean() to fix override ([#&#8203;1069](motdotla/dotenv#1069))

### [`v18.0.5`](https://github.com/motdotla/dotenv/blob/HEAD/CHANGELOG.md#1805-2026-09-30)

[Compare Source](motdotla/dotenv@v18.0.4...v18.0.5)

##### Changed

- Fix missing typescript module declaration ([#&#8203;1068](motdotla/dotenv#1068))
- Improve performance for large .env files ([#&#8203;1066](motdotla/dotenv#1066))

### [`v18.0.4`](https://github.com/motdotla/dotenv/blob/HEAD/CHANGELOG.md#1804-2026-09-25)

[Compare Source](motdotla/dotenv@v18.0.3...v18.0.4)

##### Changed

- `import dotenv/config` should default quiet: true ([#&#8203;1063](motdotla/dotenv#1063))

### [`v18.0.3`](https://github.com/motdotla/dotenv/blob/HEAD/CHANGELOG.md#1803-2026-09-22)

[Compare Source](motdotla/dotenv@v18.0.2...v18.0.3)

##### Changed

- Patch `DOTENV_QUIET` setting when inside .env file ([#&#8203;1059](motdotla/dotenv#1059))

### [`v18.0.2`](https://github.com/motdotla/dotenv/blob/HEAD/CHANGELOG.md#1802-2026-09-21)

[Compare Source](motdotla/dotenv@v18.0.1...v18.0.2)

##### Changed

- Patch additional edge cases for the fast parser ([#&#8203;1056](motdotla/dotenv#1056))

### [`v18.0.1`](https://github.com/motdotla/dotenv/blob/HEAD/CHANGELOG.md#1801-2026-09-18)

[Compare Source](motdotla/dotenv@v18.0.0...v18.0.1)

##### Changed

- Handle file urls in config logging ([#&#8203;1054](motdotla/dotenv#1054))

### [`v18.0.0`](https://github.com/motdotla/dotenv/blob/HEAD/CHANGELOG.md#1800-2026-09-17)

[Compare Source](motdotla/dotenv@v17.4.2...v18.0.0)

##### Added

- NEW: Dotenv now has a CLI. ([#&#8203;1022](motdotla/dotenv#1022))

```sh
$ dotenv run -- node index.js
◇ injected env (2) from .env
Hello Dotenv
```

- NEW: Dotenv now has a fast parser thanks to [@&#8203;homanp](https://github.com/homanp) of [superagent.sh](https://superagent.sh). Pass `config({ fast: true })`, flag `--fast`, or set `DOTENV_FAST=true` to opt-in to \~2x faster character-scanner parser. ([#&#8203;1010](motdotla/dotenv#1010))

```sh
$ dotenv run --fast -- node index.js
◇ injected env (2) from .env
Hello Dotenv
```

[faster than Node native parseEnv!](https://dotenvx.com/blog/2026/09/28/dotenv-fast.html)

##### Changed

- Injecting message sent to stderr rather than stdout and tips removed ([#&#8203;1037](motdotla/dotenv#1037))

##### Removed

- Remove tips ([#&#8203;1031](motdotla/dotenv#1031))
- Remove skill files ([#&#8203;1032](motdotla/dotenv#1032))
- Remove Spanish README ([#&#8203;1034](motdotla/dotenv#1034))
- Remove .env.vault support ([#&#8203;1033](motdotla/dotenv#1033))
- Remove preloading. Instead use cli `dotenv run -- your-command` ([#&#8203;1035](motdotla/dotenv#1035))

</details>

---

### Configuration

📅 **Schedule**: (UTC)

- Branch creation
  - "before 9am on tuesday"
- Automerge
  - At any time (no schedule defined)

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xMzMuMCIsInVwZGF0ZWRJblZlciI6IjQ0LjE3NS4xIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==-->

Reviewed-on: https://code.futo.org/harbor/harbor/pulls/1849
renovate Bot added a commit to andrei-picus-tink/auto-renovate that referenced this pull request Oct 24, 2026
| datasource | package | from   | to     |
| ---------- | ------- | ------ | ------ |
| npm        | dotenv  | 18.0.7 | 18.0.9 |


## [v18.0.9](https://github.com/motdotla/dotenv/blob/HEAD/CHANGELOG.md#1809-2026-10-14)

##### Changed

- Permit DOTENV_PATH being empty string with the CLI ([#1076](motdotla/dotenv#1076))


## [v18.0.8](https://github.com/motdotla/dotenv/blob/HEAD/CHANGELOG.md#1808-2026-10-14)

##### Changed

- Fast parser should strip appended extra quotes ([#1073](motdotla/dotenv#1073))
- Type detail improvement ([#1074](motdotla/dotenv#1074))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants