in TypeScript, it's possible to merge namespaces so if I wanted to fix the BiometryType locally whilst I wait for the PR to be merged, I could have added the following to my declarations.d.ts which means other developers on my team would also have the patch:
declare module "react-native-touch-id" {
namespace ReactNativeTouchID {
type BiometryType: 'FaceID' | 'TouchID' | true;
}
const TouchID: {
/**
*
* @param reason String that provides a clear reason for requesting authentication.
* @param config Configuration object for more detailed dialog setup
*/
authenticate(reason?: string, config?: ReactNativeTouchID.AuthenticateConfig);
/**
*
* @param config - Returns a `Promise` that rejects if TouchID is not supported. On iOS resolves with a `biometryType` `String` of `FaceID` or `TouchID`
*/
isSupported(config?: ReactNativeTouchID.IsSupportedConfig): Promise<ReactNativeTouchID.BiometryType>;
};
export default TouchID;
}
Added namespace to types so it's possible to override incorrect types in a
declarations.d.ts
file until the module is correctly patchedEdit: explanation https://www.typescriptlang.org/docs/handbook/declaration-merging.html#merging-namespaces
in TypeScript, it's possible to merge namespaces so if I wanted to fix the
BiometryType
locally whilst I wait for the PR to be merged, I could have added the following to mydeclarations.d.ts
which means other developers on my team would also have the patch: