You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The languages constant object is missing from definition despite being exported in the index.js
To Reproduce
Steps to reproduce the behavior:
Install tesseract.js
Try to import import { languages } from 'tesseract.js';
See error
Please attach any input image required to replicate this behavior.
Expected behavior
The expected behavior is to have access to languages in TypeScript codebase and avoid these kind of issue
Also, it will help to be more TypeSafe and to create some validators rules with Zod/Yup/Joi/... by passing this object directly as source of truth.
Device Version:
OS + Version: Windows 11
Browser Chrome
Additional context
My current workaround to fix this issue is to create a tesseract.d.ts file in my project and add this block:
I agree this is a good suggestion, and would reduce errors like the one you linked. However, I believe this is a breaking change so the soonest this could be implemented is Tesseract.js v6.0.
Making this change would break code for (1) TypeScript users specifying a custom language and (2) TypeScript users specifying multiple languages by concatenating them with + (e.g. eng+chi_sim). I do not believe this prevents us from ever making this change, as users with multiple languages can switch to specifying them with arrays (e.g. ['eng', 'chi_sim']) and users with custom languages (if any exist) can add a ts-ignore comment. However, this does mean such a change would need to wait for the next major release.
I will update the documentation to remove anything referencing the concatenation method for specifying multiple languages.
Tesseract.js version 5.0.4
Describe the bug
The
languages
constant object is missing from definition despite being exported in the index.jsTo Reproduce
Steps to reproduce the behavior:
tesseract.js
import { languages } from 'tesseract.js';
Please attach any input image required to replicate this behavior.
Expected behavior
The expected behavior is to have access to
languages
in TypeScript codebase and avoid these kind of issueAlso, it will help to be more TypeSafe and to create some validators rules with Zod/Yup/Joi/... by passing this object directly as source of truth.
Device Version:
Additional context
My current workaround to fix this issue is to create a
tesseract.d.ts
file in my project and add this block:But it would be better to generate the definition directly from project and by importing the JSDoc on the languages constants
Thank you.
The text was updated successfully, but these errors were encountered: