opencv-wasm
opencv-wasm copied to clipboard
Better types
Hi. I found miranda project. I think you can use these types for better syntax highlighting: https://github.com/cancerberoSgx/mirada/tree/c8721d6bbe004e31ec7578b30443c01274528a3f/mirada/src/types/opencv
Hello @morozovsk ,
Thanks for the suggestion!
Previously, I attempted to take the typings from that project (in this branch). But unfortunately, I found some errors in the typings, for example: MatVector and Mat types.
These errors make some false alarms in valid codes, so I haven't merged the that branch to the master yet.
If you are looking for types that are closer to the generated opencv.js/wasm , I'm currently working on generating typescript types directly from opencv codebase https://github.com/peteruhnak/opencv-ts (with the intention for this to eventually be part of opencv itself).
Feel free to copy the lib/typings
and lib/index.d.ts
to your library/project to test it out and report any typing issues in the linked repo.
@peteruhnak that's interesting! I'll keep track of the project.
@echamudi just update the index.d.ts as follows ( it will export all types from underlying OpenCV without any additional hassle)
import type * as openCV from './types/';
export type * as openCV from './types/';
/**
* OpenCV Object
*/
export declare const cv: typeof openCV;
/**
* Translate error number from OpenCV into a meaningful message
* @param cvObject OpenCV object
* @param err OpenCV error number
*/
export function cvTranslateError(cvObject: typeof openCV, err: any): string | Error | undefined;