Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dynamsoft-capture-vision-react-native/js/DynamsoftCameraView.tsx typescript definition incompatible with RN 0.70.6 #32

Closed
chernandez-bunnings opened this issue Mar 10, 2023 · 7 comments

Comments

@chernandez-bunnings
Copy link

chernandez-bunnings commented Mar 10, 2023

Hello,

Most recent version of dynamsoft-capture-vision-react-native@1.1.8 currently experiences typescript conflicts that have been raised during our tsc step.

Is it possible to request the team to have a look in to the typing definitions to solve these conflicts? For now, I'm patching the package and skipping ts compiler from checking this file dynamsoft-capture-vision-react-native/js/DynamsoftCameraView.tsx by adding // @ts-nocheck at the top of the problematic file. This way our CI won't raise the exception. Ideally I should drop this patch as soon as the issue is resolved in the package directly.

Details of the typings errors:

$ tsc
Error: node_modules/dynamsoft-capture-vision-react-native/js/DynamsoftCameraView.tsx(46,7): error TS2322: Type 'ComponentType<any>' is not assignable to type 'HostComponent<any>'.
  Type 'ComponentClass<any, any>' is not assignable to type 'HostComponent<any>'.
    Type 'Component<any, any, any>' is not assignable to type 'Component<any, {}, any> & Readonly<NativeMethods>'.
      Type 'Component<any, any, any>' is missing the following properties from type 'Readonly<NativeMethods>': measure, measureInWindow, measureLayout, setNativeProps, and 2 more.
Error: node_modules/dynamsoft-capture-vision-react-native/js/DynamsoftCameraView.tsx(51,[9](...)): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{}'.
  No index signature with a parameter of type 'string' was found on type '{}'.
Error: node_modules/dynamsoft-capture-vision-react-native/js/DynamsoftCameraView.tsx([10](...): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ torchState: any; }'.
  No index signature with a parameter of type 'string' was found on type '{ torchState: any; }'.
Error: node_modules/dynamsoft-capture-vision-react-native/js/DynamsoftCameraView.tsx(102,20): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type '{ torchState: any; }'.
  No index signature with a parameter of type 'string' was found on type '{ torchState: any; }'.
Error: node_modules/dynamsoft-capture-vision-react-native/js/DynamsoftCameraView.tsx([14](...): error TS7053: Element implicitly has an 'any' type because expression of type 'string' can't be used to index type 'UIManagerStatic'.
  No index signature with a parameter of type 'string' was found on type 'UIManagerStatic'.
error Command failed with exit code 2.

Note: forgot to mentioned that some of those typing conflicts present on react-native@0.70.6

@chernandez-bunnings chernandez-bunnings changed the title dynamsoft-capture-vision-react-native/js/DynamsoftCameraView.tsx typescript definition errors dynamsoft-capture-vision-react-native/js/DynamsoftCameraView.tsx typescript definition errors RN 0.70.6 Mar 10, 2023
@chernandez-bunnings chernandez-bunnings changed the title dynamsoft-capture-vision-react-native/js/DynamsoftCameraView.tsx typescript definition errors RN 0.70.6 dynamsoft-capture-vision-react-native/js/DynamsoftCameraView.tsx typescript definition incompatible with RN 0.70.6 Mar 10, 2023
@Dynamsoft-Henry
Copy link
Collaborator

Hello @chernandez-bunnings

Thanks for reporting this issue. We are looking at it. I'll let you know if we can resolve the conflicts.

@Dynamsoft-Henry
Copy link
Collaborator

Hello @chernandez-bunnings

We have released a new version v1.1.9 to fix the conflicts. You can try the new version now.

@chernandez-bunnings
Copy link
Author

chernandez-bunnings commented Mar 15, 2023

Confirming that in version 1.1.9 those ts errors are not raised. Ideally enforcing the types would be great, as I can see this new version defines those types as any in those instances where there were errors. This fix works for now, for me to drop the patch. Thank you for looking into it.

If in the future a more strict type definition is supported that would be very much appreciated.

@chernandez-bunnings
Copy link
Author

chernandez-bunnings commented Mar 16, 2023

Apologies for providing a false positive confirmation. During my initial test, I didn't experience the issue.
However doing a clean install, we still experience one typing error:
image

$ tsc
Error: node_modules/dynamsoft-capture-vision-react-native/js/DynamsoftCameraView.tsx(46,7): error TS2322: Type 'ComponentType<any>' is not assignable to type 'HostComponent<any>'.
  Type 'ComponentClass<any, any>' is not assignable to type 'HostComponent<any>'.
    Type 'Component<any, any, any>' is not assignable to type 'Component<any, {}, any> & Readonly<NativeMethods>'.
      Type 'Component<any, any, any>' is missing the following properties from type 'Readonly<NativeMethods>': measure, measureInWindow, measureLayout, setNativeProps, and 2 more.
error Command failed with exit code 2.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@chernandez-bunnings
Copy link
Author

Hello @Dynamsoft-Henry, just wondering if there are any updates on this?
We are finalising development work for the barcode scanner. It would be great if we did not have to use a patch to ensure the tsc passes correctly in our ci.
I had a quick look into v1.1.12 and the issues still occurs.

@Dynamsoft-Henry
Copy link
Collaborator

@chernandez-bunnings
Apologize for the late reply. We will fix it as soon as possible.

@Dynamsoft-Henry
Copy link
Collaborator

Hi @chernandez-bunnings
Would you like to share your tsconfig.json file with us. So that we can confirm whether the issue is solved on you end.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants