Skip to content

Move from JS to TS #44

Description

@aryanjasala

Convert build sources to TypeScript

Context

Our block theme and feature-plugin skeletons are authored in JavaScript. We want them to be TypeScript-first so consuming projects get type safety, editor IntelliSense, and earlier error detection. @wordpress/scripts already supports TypeScript, so this is a build-time change only — runtime behavior and shipped assets stay the same.

Goal

All source under src/ is written in TypeScript (.ts/.tsx), type-checked in CI, with no change to compiled output or runtime behavior.

Scope

  • Block theme
  • Feature-plugin skeleton

(Both should end up with an identical TypeScript + lint setup.)

Deliverables

  • TypeScript tooling configured (tsconfig, ambient type declarations, a type-check script).
  • All src/ JavaScript converted to .ts/.tsx, including blocks and components.
  • Linting and type-checking run in CI for TypeScript on every relevant PR.

Definition of done

  • Type-checking passes across src/ with a reasonably strict config.
  • JS/TS linting and CSS linting pass.
  • build and start work unchanged; compiled JS output is equivalent to before.
  • No JavaScript remains under src/ (root build-config files may stay JS).

Considerations

  • Use first-party @wordpress types where available; fall back to community type stubs only where a package ships none.
  • Keep the runtime React version and its type definitions aligned to avoid duplicate/incompatible React types.
  • Type-checking is additive — it must not alter the built assets or block registration.

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions