Type the city-tile envelope; drop the registry any [skip release]#21
Merged
Conversation
- Add CityTileFc (FeatureCollection<Point, CityForecast> & { snapshotMs, hours })
in weather.ts, mirroring LatticeFc, and type temp.tsx's explodeCities against
it — deleting the hand-rolled inline tile shape so the payload tracks the
generated CityForecast/Point types instead of drifting silently.
- Replace `WeatherLayer<any>[]` with `WeatherLayer<unknown>[]` via a defineLayer
existential helper: each layer is still type-checked as its own
WeatherLayer<D> (select→build sound per layer), but the registry no longer
needs `any`, which would have accepted a malformed layer.
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.
From the audit (type-safety lane).
CityTileFc— the per-city-tile payload was hand-declared inline intemp.tsx, outside the codegen drift check. Replaced withCityTileFc = FeatureCollection<Point, CityForecast> & { snapshotMs, hours }inweather.ts(mirrorsLatticeFc), built from the generatedCityForecast/Pointso it tracks the Rust contract. The contract'sCityTile<G,P>doc-comment already specifies exactly this envelope.any→unknown—LAYERS: WeatherLayer<any>[]erased all type safety.WeatherLayer<D>is invariant inD, so a shared array can't hold specific layers directly; adefineLayer<D>existential helper type-checks each layer as its ownWeatherLayer<D>(keepingselect→buildsound per layer) and erases only the array's view tounknown. Tighter thanany, which would accept a malformed layer.No runtime/behavior change. tsc, biome, build all pass.
Docs & attribution