Skip to content

feat: migrate Sanity schemas to TypeScript#24

Open
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1776394805-migrate-sanity-schemas-to-ts
Open

feat: migrate Sanity schemas to TypeScript#24
devin-ai-integration[bot] wants to merge 1 commit into
mainfrom
devin/1776394805-migrate-sanity-schemas-to-ts

Conversation

@devin-ai-integration
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration Bot commented Apr 17, 2026

Summary

Migrates the Sanity Studio schema files (sanity_ecommerce/schemas/) from JavaScript to TypeScript:

  • Renamed product.jsproduct.ts, banner.jsbanner.ts, schema.jsschema.ts (via git mv)
  • Added type annotations to product.ts and banner.ts with explicit interfaces (SanitySchemaDefinition, SanityField, SanityFieldOptions)
  • Created sanity_ecommerce/sanity.d.ts with declare module statements for Sanity v2 part: imports (part:@sanity/base/schema-creator and all:part:@sanity/base/schema-type)
  • Updated sanity_ecommerce/tsconfig.json with proper compilerOptions for type-checking and included sanity.d.ts

No runtime behavior changes — Sanity v2 uses Babel for transpilation, so the tsconfig is used only for editor support and tsc --noEmit validation.

npx tsc --noEmit passes cleanly from the sanity_ecommerce/ directory.

Review & Testing Checklist for Human

  • Verify Sanity Studio still starts/builds — run sanity start and sanity build inside sanity_ecommerce/ to confirm the Babel-based build isn't broken by the .ts renames. This is the most important check since CI may not cover the Sanity sub-project.
  • Review duplicated interfacesSanitySchemaDefinition, SanityField, and SanityFieldOptions are defined locally in both product.ts and banner.ts (with slight differences in SanityFieldOptions). Consider whether these should be extracted to a shared types file.
  • tsconfig.json changes — the original config had a comment noting "compiler configuration here will be ignored" by Sanity v2. The new config adds real compilerOptions including ignoreDeprecations: "6.0" (needed for moduleResolution: "node" on TS 6.0+). Confirm this doesn't interfere with the Sanity build pipeline.

Notes

  • schema.ts is a pure rename with no content changes — the part: imports are handled by the new sanity.d.ts ambient declarations.
  • The declare module types use any for 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


Open with Devin

- 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>
@devin-ai-integration
Copy link
Copy Markdown
Author

🤖 Devin AI Engineer

I'll be helping with this pull request! Here's what you should know:

✅ I will automatically:

  • Address comments on this PR. Add '(aside)' to your comment to have me ignore it.
  • Look at CI failures and help fix them

Note: I can only respond to comments from users who have write access to this repository.

⚙️ Control Options:

  • Disable automatic comment and CI monitoring

Copy link
Copy Markdown
Author

@devin-ai-integration devin-ai-integration Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no potential bugs to report.

View in Devin Review to see 2 additional findings.

Open in Devin Review

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