test: trip when the mirrored editor types move upstream - #63
Open
sidgaikwad wants to merge 1 commit into
Open
Conversation
src/types.ts hand-copies MountOptions, ImageEditorInstance, ImageEditorEmbed and ImageEditorSaveResult from the private @unlayer/image-editor package, with a comment saying it does so "until they move into @unlayer/types". Nothing enforced the "until". Once the move happens the local copies silently become a second, diverging source of truth — which is how a missing dock/corners reached users in unlayer#25. Add a tripwire that scans the installed @unlayer/types declarations and fails the moment any mirrored name appears there, with a message saying to delete the local copy and re-export instead. This is deliberately not a full drift check. Detecting the private package changing underneath us needs access this repository does not have, so that half stays a human responsibility — now at least written down next to the declarations.
|
@sidgaikwad is attempting to deploy a commit to the Unlayer Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Partially addresses #42 — please read the caveat before merging.
What this does
src/types.tshand-copiesMountOptions,ImageEditorInstance,ImageEditorEmbedandImageEditorSaveResultfrom the private@unlayer/image-editorpackage, with a comment saying it does so "until they move into@unlayer/types". Nothing enforced the "until".Once that move happens, the local copies silently become a second, diverging source of truth. That's exactly how #25 (
Features.imageEditormissingdock/corners) reached users.test/typesDrift.test.tsscans the installed@unlayer/typesdeclarations and fails the moment any mirrored name appears there:(That output is from deliberately adding a name that does exist upstream, to prove the tripwire fires — it passes as-is today, since
@unlayer/types@1.477.0exports none of the four.)The
KEEP IN SYNCcomment now points at the test, so the enforcement is discoverable from the declarations.What this deliberately does NOT do
It does not detect the private
@unlayer/image-editorpackage changing underneath you — the more dangerous direction, where a renamed instance method typechecks fine and throws at runtime.Of the three options in the issue:
@unlayer/types— the durable fix, and the comment's own stated intent. Only Unlayer can publish that.So this closes the cheap half and leaves the real fix as yours. Happy to do the
@unlayer/typesmigration in a follow-up if you publish the types there.Tests 47, coverage still 100%;
lint,typecheck,buildclean.