Correct TypeScript signature for minEnclosingCircle
to match opencv.js single parameter
#57
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.
This pull request corrects the TypeScript definition of the
minEnclosingCircle
function to align with the opencv.js implementation, which accepts only a single parameter. The existing type definitions mistakenly required three parameters to be passed to this function, which conflicted with the actual opencv.js API and led to compile-time errors in TypeScript projects.The erroneous type signature forced TypeScript developers to call
minEnclosingCircle
incorrectly with three arguments or to suppress type checking with a@ts-ignore
comment, neither of which is an ideal solution.To address this issue, I have updated the function signature in the TypeScript definitions to accept only one parameter, as per the opencv.js documentation. Additionally, I have introduced a new
Circle
class definition that encapsulates the return type ofminEnclosingCircle
, providing a structured object that contains both thecenter
point andradius
of the circle.The
Circle
class enhances type safety and developer experience by offering clear insights into the expected return object structure, which includes:center
: The center point of the enclosing circle.radius
: The radius of the enclosing circle.By merging this pull request, we will ensure that the TypeScript definitions correctly represent the opencv.js library's API, thus preventing any confusion and errors when developers invoke
minEnclosingCircle
. This change will also promote better code quality and maintainability in TypeScript projects leveraging opencv.js.