Skip to content

Fix locale data type annotation to resolve TS7056 serialization error - #3040

Closed
sejas wants to merge 1 commit into
trunkfrom
fix-locale-data-type-annotation
Closed

Fix locale data type annotation to resolve TS7056 serialization error#3040
sejas wants to merge 1 commit into
trunkfrom
fix-locale-data-type-annotation

Conversation

@sejas

@sejas sejas commented Apr 9, 2026

Copy link
Copy Markdown
Member

Related issues

  • Fixes the TypeScript error: "The inferred type of this node exceeds the maximum length the compiler will serialize. An explicit type annotation is needed. (ts 7056)" in tools/common/translations/index.ts

How AI was used in this PR

Claude suggested the fix approach (explicit type annotation with SupportedLocale union type). The implementation was reviewed and verified with npm run typecheck.

Proposed Changes

  • Add explicit LocaleData type matching the JED JSON structure ({ messages: Record<...> })
  • Add SupportedLocale union type for all supported locale keys
  • Annotate localeDataDictionary with Record<SupportedLocale, LocaleData | null> instead of relying on as const inference
  • Remove as const assertion that caused TypeScript to serialize the entire translation literal types

Testing Instructions

  • Run npm run typecheck — should pass with no errors
  • Verify translations still work: npm start, change language in settings, confirm UI strings update

Pre-merge Checklist

  • Have you checked for TypeScript, React or other console errors?
node exceeds the maximum length the compiler will serialize. An explicit
type annotation is needed. (ts 7056)
@sejas sejas self-assigned this Apr 9, 2026
@sejas

sejas commented Apr 9, 2026

Copy link
Copy Markdown
Member Author

Closing this PR as it will be merged in the beta backmerge #3041

@sejas sejas closed this Apr 9, 2026
@sejas
sejas deleted the fix-locale-data-type-annotation branch April 9, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant