Skip to content

Commit d27fe45

Browse files
🔖 chore(package.json): update @typescript-eslint/parser and @typescript-eslint/eslint-plugin to version 5.59.6
🔖 chore(package.json): update package version to 0.0.9 🔥 chore(package.json): move mirada to optionalDependencies 🐛 fix(index.ts): import types from mirada/dist/src/types/_cv instead of mirada 🐛 fix(OpenCvProvider.tsx): remove ts-ignore and set cv instance after runtime initialization to fix cv not being defined error
1 parent 14f5065 commit d27fe45

File tree

4 files changed

+118
-115
lines changed

4 files changed

+118
-115
lines changed

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "opencv-react-ts",
3-
"version": "0.0.8",
3+
"version": "0.0.9",
44
"description": "OpenCV react wrapper. Hooks first API.",
55
"author": "subho57",
66
"license": "MIT",
@@ -47,8 +47,8 @@
4747
"@types/jest": "^29.5.1",
4848
"@types/react": "^18.2.6",
4949
"@types/react-dom": "^18.2.4",
50-
"@typescript-eslint/eslint-plugin": "^5.59.5",
51-
"@typescript-eslint/parser": "^5.59.5",
50+
"@typescript-eslint/eslint-plugin": "^5.59.6",
51+
"@typescript-eslint/parser": "^5.59.6",
5252
"cross-env": "^7.0.3",
5353
"eslint": "^8.40.0",
5454
"eslint-config-airbnb-base": "^15.0.0",
@@ -82,7 +82,7 @@
8282
"files": [
8383
"dist"
8484
],
85-
"dependencies": {
85+
"optionalDependencies": {
8686
"mirada": "^0.0.15"
8787
},
8888
"packageManager": "yarn@3.5.1"

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
export * from './lib/OpenCvProvider';
22
export * from './lib/useOpenCv';
3-
export * from 'mirada';
3+
export * from 'mirada/dist/src/types/_cv';

src/lib/OpenCvProvider.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,15 @@ export const OpenCvProvider: React.FC<IOpenCvProviderProps> = ({ openCvVersion =
2828
});
2929

3030
React.useEffect(() => {
31-
// @ts-ignore
3231
if (document.getElementById(scriptId) || window.cv) {
32+
setCvInstance({ loaded: true, cv: window.cv });
3333
return;
3434
}
3535

3636
// https://docs.opencv.org/3.4/dc/de6/tutorial_js_nodejs.html
3737
// https://medium.com/code-divoire/integrating-opencv-js-with-an-angular-application-20ae11c7e217
3838
// https://stackoverflow.com/questions/56671436/cv-mat-is-not-a-constructor-opencv
3939
moduleConfig.onRuntimeInitialized = () => {
40-
// @ts-ignore
4140
setCvInstance({ loaded: true, cv: window.cv });
4241
};
4342
// @ts-ignore

0 commit comments

Comments
 (0)