refactor!: use stac-ts for types#54
Open
alukach wants to merge 2 commits into
Open
Conversation
stac-react was declaring its own Item, Collection, Link, ItemAsset, Provider, Extent, etc. types that drifted from the STAC spec (and from stac-ts, which consumers already use). The drift caused friction in consumer code: Collection.description was optional here but required in stac-ts, Item.collection lived at properties.collection rather than at the top level (per spec), Item.geometry diverged from GeoJSON, and so on. This change adds stac-ts as a runtime dependency and rewrites src/types/stac.d.ts so document types come from stac-ts (StacItem, StacCollection, StacLink, StacAsset, StacProvider, StacRoles, StacVersion, StacExtensions, StacCatalog), re-exported from stac-react so consumers don't need a separate import surface. Kept locally because they're stac-react-specific: - Bbox tuple, IdList, CollectionIdList, DateRange, Sortby - SearchPayload, SearchRequestPayload, FetchRequest, LinkBody - Link (extends StacLink with stac-react-pagination fields like body) - SearchResponse, CollectionsResponse (wrappers around StacItem[] / StacCollection[]) Internal hooks (useItem, useCollection) updated to consume StacItem and StacCollection. Public hook return types change shape (StacItem replaces the old Item) — alpha-window breaking change with no migration path beyond renaming the imports. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.
While the
stac-managerusesstac-tsfor types1, this project creates its own types for STAC objects. This puts a maintenance burden on the project (e.g. I initially started down this path of exploration when I realized that ourCollectiontype was missing the requireddescriptionfield.This PR add
stac-tsas apeerDependencyof the project.Footnotes
https://github.com/developmentseed/stac-manager/blob/c63c760829f018722198dfeecd2ba925fb4ba664/packages/client/package.json#L89 ↩