Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add undefined type to opt_b and opt_c in patch_make() #51

Merged
merged 2 commits into from
Jun 17, 2024

Conversation

thyme4soup
Copy link
Contributor

Hey, first off thank you so much for this library

I'm trying to use patch_make() and running into an issue when compiling my typescript where to use method 2 of patch_make you need to pass 'undefined'. I'm able to get around this by either not passing the opt_c argument or ignoring the error and setting it to 'undefined,' but it fails when building in github workflow

I think just adding 'undefined' to the allowed types would do it

@@ -457,8 +457,8 @@ export class DiffMatchPatch {
*/
public patch_make(
a: string | Diff[],
opt_b: string | Diff[],
opt_c: string | Diff[],
opt_b: string | Diff[] | undefined,
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we change these to optional arguments so that we can call patch_make with 1 or 2 parameters (e.g. patch_make(text1)) and avoid requiring explicit undefined values being passed (i.e. patch_make(text1, undefined, undefined))?

Suggested change
opt_b: string | Diff[] | undefined,
opt_b?: string | Diff[],

@thyme4soup
Copy link
Contributor Author

hey sorry about the delay, switched them to optional arguments per your suggestion

@rars rars merged commit c8ed890 into rars:main Jun 17, 2024
2 checks passed
@rars
Copy link
Owner

rars commented Jun 17, 2024

Thanks @thyme4soup, this has been released in https://github.com/rars/diff-match-patch-ts/releases/tag/v0.6.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants