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 of minEnclosingCircle, providing a structured object that contains both the center point and radius 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.
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.