react-native-square-reader-sdk icon indicating copy to clipboard operation
react-native-square-reader-sdk copied to clipboard

Fix Typescript Support

Open caleb-harrelson opened this issue 3 years ago • 0 comments

Summary

The existing TypeScript support, added via PR #148, is broken. The types aren't available when consumed, are incorrect anyway, and the PR contained breaking changes.

This PR reverts everything in #148 and adds TypeScript support without changing any code, via a manually crafted index.d.ts file, which is referenced from package.json so that consumers get the types and documentation that comes with it. Documentation came from the existing documentation in this repo, including a small typo fix to it.

Note: since this is a manually crafted file, it should be considered documentation and updated whenever public APIs are changed. If a change is necessary for reference.md it's most likely necessary in index.d.ts too.

Related issues

Fixes broken PR #148

Changelog

  • Fixed TypeScript support

Test Plan

I've been using this declarations file in my working TypeScript code for a long time. I learned yesterday that #148 "added TypeScript support" but also broke the code, and was deployed as part of a version update I hadn't consumed until this week. PR #198 fixes the broken code in the least invasive way possible, while this PR addresses the TypeScript not actually working part, without the code modifications done by #148.

I tested this PR by removing the declarations file from my project and making the same changes to the node_modules/react-native-square-reader-sdk directory that I've made here, then ensuring that TypeScript types and documentation were still functional.

caleb-harrelson avatar Oct 05 '22 15:10 caleb-harrelson