Publishing Version 3 #190
otakustay
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
The Goal
From the very begining of this library, more than 5 years have past, I noticed I haven't update it for a long time, community demand on TypeScript increase fast in this period.
To support TypeScript, we once tried #148 to add types without any breaking change, but this is extremely difficult, later I decide to have a big refactor on my codebase and allow myself to introduce a few breaking changes in edge cases.
Version 3 is mostly aimed to add types, I tried my best to NOT add breaking changes, this includes:
<script>
tag.refractor
is not updated, still uses2.x
version.We expect a Upgrade-And-Go experience when you upgrading to
3.0.0
.The Type
I added types to all components and util functions, most of them are strict.
The interesting is our
ChangeData
type is a union type of 3 interfaces:From now on you can't destruct a
ChangeData
object without checking its type, code like this will report a type error:I added 3 util functions (
isInsert(change)
,isDelete(change)
,isNormal(change)
) to help discriminstae the type of aChangeData
object, use it like this:You may encounter many type errors upgrading to
3.0.0
, however I expect runtime behavior to stay unchanged, on any type problem, feel free to raise a question on GitHub discussion.Breaking Changes
Although I struggled to leave all breaking changes out of this version, in some edge cases you may see some behavior changed, expecially in old browsers.
Once you find it crashes in some old browsers, try to include
react-diff-view
intobabel-loader
or other transformers.What's Next
In the near future, I plan to refine some peripherals of this repository:
After all these, I'll move to the next big version, there will be a lot of breaking changes there, I'll write a post to demostrate what I expect before I start.
Starting from the next big version, I'll publish this library under
@otakustay/react-diff-view
.Beta Was this translation helpful? Give feedback.
All reactions