dev #14
Loading…
Reference in a new issue
No description provided.
Delete branch "dev"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Third phase of the staged dependency upgrade (majors, one per commit). Crosses react-intl 11 and 12. No runtime behaviour change is expected (upstream: 11 and 12 are type-level and additive) and all 3014 unit tests pass with unchanged assertions. From 12.0.2 an unannotated `defineMessages` descriptor carries an EMPTY ICU argument contract, so every `formatMessage(desc, values)` call failed typecheck (160 errors in 25 files). Each catalog now declares its contract — one entry per message id, derived from the ICU syntax of each defaultMessage with formatjs's own parser: `number` for plural and number arguments, `number | Date` for date and time, `string | number` for plain and select arguments, `MessageTag` for rich-text tags, `NoMessageValues` for argument-less messages. Shape: the contract is a named type per catalog, written once and used for both the explicit annotation and the `defineMessages` generic: type XMessagesContract = { copied: { count: number }; title: NoMessageValues }; export const xMessages: MessageCatalog<XMessagesContract> = defineMessages<XMessagesContract>({ ... }); The annotation is what upstream's own migration emits: the type a catalog infers reaches into intl-messageformat (a transitive dependency), which the compiler cannot name for an exported binding under `declaration: true` (TS2883). `MessageCatalog` (src/i18n/message-catalog.ts) is spelled only in types react-intl exports. The catalogs keep calling `defineMessages` directly because `formatjs extract` — the source of the fr-FR catalog and of the locale-catalog gate — recognises descriptors by that call. Eight catalogs annotated (511 ids). Left untouched: the four without any argument-taking message and the three annotation-widened catalogs in metadata/field-messages.ts. Each declaration stays on one line so the catalog bodies keep their indentation (these files are not Prettier-formatted). Call-site typing only, no behaviour change: - SourcePickerSizeIndicator.tsx: the two value bags get named shapes instead of `Record<string, ...>` index signatures, which cannot satisfy named contract properties. - Three tests: the rich-text stand-in callbacks accept `string | ReactNode` chunks, the chunk type a typed contract hands to tag callbacks. Gate: clean frozen install, pnpm check (including the locale-catalog extraction drift gate), typecheck, lint, build, unit suites green. Co-Authored-By: Xavier's assistant <assistant@gijoe88.com>View command line instructions
Checkout
From your project repository, check out a new branch and test the changes.