Skip to content

inline Position in TS exports#6

Merged
johncarmack1984 merged 1 commit into
mainfrom
john/inline-position
May 5, 2026
Merged

inline Position in TS exports#6
johncarmack1984 merged 1 commit into
mainfrom
john/inline-position

Conversation

@johncarmack1984
Copy link
Copy Markdown
Collaborator

Summary

#[specta(inline)] on geojson::Position so it doesn't export as a named TS alias.

Previously the fork's specta-feature path produced export type Position = number[];, which fights for the Position name with downstream consumers -- in particular fltsci's flights_api::Position (a discriminated union over Air/Ground positions). Marking Position as inline keeps the inner type override (#[specta(type = Vec<f64>)]) but renders each usage as a literal number[] instead of a named alias, so there's no name collision.

Behavior

  • Wire format: unchanged (still [lon, lat, ...]).
  • Rust API: unchanged (Position remains a public newtype).
  • Non-specta builds: unchanged (the new attribute is cfg_attr(feature = "specta", ...)).
  • TS output: Position no longer appears as a named alias; everywhere a Position was referenced, number[] appears inline.

Test plan

  • cargo build --features specta clean
  • cargo test --features specta clean (37 passed, 0 failed)

geojson::Position would otherwise export as a named TS alias `type
Position = number[]`, which collides with downstream consumers that
also have a Position type (e.g. fltsci's flights_api::Position
discriminated union). Mark it specta(inline) so each usage emits the
inline number[] shape and the name slot stays free for the consumer.
@johncarmack1984 johncarmack1984 merged commit 7909f87 into main May 5, 2026
4 checks passed
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.

1 participant