fix(specta): set ndt.ty in build_ndt for rc.25 init_with_sentinel#10
Draft
johncarmack1984 wants to merge 1 commit into
Draft
fix(specta): set ndt.ty in build_ndt for rc.25 init_with_sentinel#10johncarmack1984 wants to merge 1 commit into
johncarmack1984 wants to merge 1 commit into
Conversation
rc.25 split init_with_sentinel into separate build_ndt (metadata + exported type) and build_ty (inline-reference type) callbacks. Without setting ndt.ty in build_ndt, the named type registers but its body is never written, so consumers reference an undefined JsonValue alias in the generated TS.
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.
Summary
init_with_sentinelin specta rc.25 split into two callbacks:build_ndt(metadata + exported type body) andbuild_ty(type used for inline references). The currentJsonValueimpl only sets metadata inbuild_ndt, never assignsndt.ty, so the named type registers but its body is never written.Result: any field overridden as
#[specta(type = ::geojson::specta_compat::JsonValue)]produces TS bindings that reference an undefinedJsonValuealias.Fix
Mirror the pattern specta-macros uses for derived types: hoist the type body into a local
fn build, call it insidebuild_ndtto assignndt.ty, and pass the same fn as thebuild_tyargument.Same shape was applied to fltsci's internal
string_enum_type!/opaque_ts_type!macros in the bump branch.Test plan
cargo build -p geojsoncleanJsonValueis now defined as a top-level alias rather than referenced-but-undefined