Skip to content

Commit 8da9f21

Browse files
committed
Make as assertion rely on inference instead of hard-coded type casting
If anything changes in the typing of `ChangeCategory` or `unreleasedChanges` that make them inconsistent, this code will fail silently. Relying on type inference instead of explicit type casting will make these line a little less brittle. - TODO: document and expound in MetaMask/contributor-docs#47
1 parent f950f3e commit 8da9f21

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/changelog.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,9 @@ export default class Changelog {
383383

384384
const unreleasedChanges = this.#changes[unreleased];
385385

386-
for (const category of Object.keys(unreleasedChanges) as ChangeCategory[]) {
386+
for (const category of Object.keys(
387+
unreleasedChanges,
388+
) as (keyof typeof unreleasedChanges)[]) {
387389
if (releaseChanges[category]) {
388390
releaseChanges[category] = [
389391
...(unreleasedChanges[category] ?? []),

0 commit comments

Comments
 (0)