feat: migrate Sanity schemas to TypeScript#24
Open
devin-ai-integration[bot] wants to merge 1 commit into
Open
Conversation
- Rename product.js, banner.js, schema.js to .ts equivalents - Add explicit type annotations (SanitySchemaDefinition, SanityField, SanityFieldOptions) - Create sanity.d.ts with declare module statements for Sanity v2 part: imports - Update tsconfig.json with proper compiler options for the sub-project - Verified: no .js files remain in schemas/, tsc --noEmit passes cleanly Co-Authored-By: Wes Convery <2wconvery@gmail.com>
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
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
Migrates the Sanity Studio schema files (
sanity_ecommerce/schemas/) from JavaScript to TypeScript:product.js→product.ts,banner.js→banner.ts,schema.js→schema.ts(viagit mv)product.tsandbanner.tswith explicit interfaces (SanitySchemaDefinition,SanityField,SanityFieldOptions)sanity_ecommerce/sanity.d.tswithdeclare modulestatements for Sanity v2part:imports (part:@sanity/base/schema-creatorandall:part:@sanity/base/schema-type)sanity_ecommerce/tsconfig.jsonwith propercompilerOptionsfor type-checking and includedsanity.d.tsNo runtime behavior changes — Sanity v2 uses Babel for transpilation, so the tsconfig is used only for editor support and
tsc --noEmitvalidation.npx tsc --noEmitpasses cleanly from thesanity_ecommerce/directory.Review & Testing Checklist for Human
sanity startandsanity buildinsidesanity_ecommerce/to confirm the Babel-based build isn't broken by the.tsrenames. This is the most important check since CI may not cover the Sanity sub-project.SanitySchemaDefinition,SanityField, andSanityFieldOptionsare defined locally in bothproduct.tsandbanner.ts(with slight differences inSanityFieldOptions). Consider whether these should be extracted to a shared types file.compilerOptionsincludingignoreDeprecations: "6.0"(needed formoduleResolution: "node"on TS 6.0+). Confirm this doesn't interfere with the Sanity build pipeline.Notes
schema.tsis a pure rename with no content changes — thepart:imports are handled by the newsanity.d.tsambient declarations.declare moduletypes useanyfor the Sanity v2 part imports, which is expected given Sanity v2's limited TS support.Link to Devin session: https://app.devin.ai/sessions/a38d42803fa24db9948a850373cdcb26
Requested by: @WesternConcrete