refactor: type-safe config#22445
Merged
spalladino merged 11 commits intomerge-train/spartanfrom Apr 14, 2026
Merged
Conversation
spypsy
reviewed
Apr 10, 2026
| // Parse the value if needed | ||
| if (value !== undefined) { | ||
| // Parse the value if needed. Empty strings are treated as "not set". | ||
| if (value) { |
Member
There was a problem hiding this comment.
nit but would prefer explicitly checking for value !== undefined && value !== '' just because JS truthy checks can get dodgy (it should be fine now that value is string | undefined but just to be extra safe)
spypsy
approved these changes
Apr 14, 2026
spalladino
approved these changes
Apr 14, 2026
This was referenced Apr 14, 2026
spalladino
pushed a commit
that referenced
this pull request
Apr 14, 2026
## Summary Fixes two TypeScript type errors introduced by PR #22445 (refactor: type-safe config). `ConfigMappingsType<T>` uses `Required<T>[K]` to derive the `parseEnv` return type, so for optional `number` fields, `parseEnv` must return `number` — not `number | undefined`. The `undefined` case for missing env vars is already handled by the config framework before `parseEnv` is called. - `stdlib/src/config/sequencer-config.ts`: `attestationPropagationTime.parseEnv` now returns `number` instead of `number | undefined` - `p2p/src/config.ts`: `l1PublishingTime.parseEnv` now returns `number` instead of `number | undefined` ClaudeBox log: https://claudebox.work/s/1b406eba6bceb29c?run=1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ref: A-175
ConfigMapping<T>ConfigMappingsType<T> = Record<keyof T, ConfigMapping<any>>with a per-key mapped type:{ [K in keyof T]-?: ConfigMapping<Required<T>[K]> }parseEnvmust return T or throw — empty strings are treated as "not set" beforeparseEnvis calledsequencerClientConfigMappingswhere narrowl1ContractsfromchainConfigMappingswas overwriting the full set froml1ReaderConfigMappings