src/types.ts carries this warning:
https://github.com/unlayer/react-image-editor/blob/628b507/src/types.ts#L18-L20
// KEEP IN SYNC WITH packages/image-editor/src/index.ts in the unlayer
// monorepo — these mirror the private @unlayer/image-editor package's
// public API until they move into @unlayer/types.
MountOptions, ImageEditorInstance, ImageEditorEmbed and ImageEditorSaveResult are all hand-copied from a package this repo does not depend on. The only thing keeping them accurate is a code comment and a maintainer remembering.
Why this is worth a guard
The drift is silent in both directions and both are user-visible:
- Option added upstream → not typeable here. Consumers get a type error passing a real, supported option and have to cast.
- Option renamed/removed upstream → still accepted here, passed straight through
createEditor, ignored at runtime. Nothing fails; the feature just doesn't work.
- Instance method changed →
ImageEditorInstance claims a method that no longer exists; editorRef.current.editor.foo() throws at runtime with a fully green typecheck.
Issue #25 (Features.imageEditor missing dock and corners) was exactly this class of bug — it reached users before it was noticed.
Options
- Finish the stated plan — move these into
@unlayer/types (which is already a real dependency, currently pinned at 1.477.0) and delete the local copies. This is the comment's own "until".
- Add a CI drift check — if the private package publishes anything consumable, diff the two declaration sets in CI and fail on divergence.
- At minimum, add a runtime-shape test asserting
ImageEditorInstance's method names against the live embed, so a rename surfaces as a red test rather than a support ticket.
Option 1 is the durable one; the comment already says that's the intent.
src/types.tscarries this warning:https://github.com/unlayer/react-image-editor/blob/628b507/src/types.ts#L18-L20
MountOptions,ImageEditorInstance,ImageEditorEmbedandImageEditorSaveResultare all hand-copied from a package this repo does not depend on. The only thing keeping them accurate is a code comment and a maintainer remembering.Why this is worth a guard
The drift is silent in both directions and both are user-visible:
createEditor, ignored at runtime. Nothing fails; the feature just doesn't work.ImageEditorInstanceclaims a method that no longer exists;editorRef.current.editor.foo()throws at runtime with a fully green typecheck.Issue #25 (
Features.imageEditormissingdockandcorners) was exactly this class of bug — it reached users before it was noticed.Options
@unlayer/types(which is already a real dependency, currently pinned at1.477.0) and delete the local copies. This is the comment's own "until".ImageEditorInstance's method names against the live embed, so a rename surfaces as a red test rather than a support ticket.Option 1 is the durable one; the comment already says that's the intent.