Hi,
I am trying to use the AppleError enum in a runtime check, which looks something like this:
import {
appleAuth,
AppleError
} from '@invertase/react-native-apple-authentication';
...
export function isNativeFirebaseError(
error: any
): error is ReactNativeFirebase.NativeFirebaseError {
return error && error.code && error.message;
}
try {
// do stuff
} catch (err) {
if (isNativeFirebaseError(err) && err.code === AppleError.FAILED) {
// do stuff
}
}
The issue is that while the typechecking passes, AppleError enum is not available at runtime as it's declared in
|
export declare enum AppleError { |
console.log(AppleError) // undefined
However, the code is correctly assigned in the error:
try {
// do stuff
} catch (err) {
if (isNativeFirebaseError(err) && err.code === "1004") {
// does not throw, it's ok!
}
}
This also affects all the other declared enums on that file too. I think the easiest fix would be removing the declare keyword from the typedef or marking them as const instead.
Hi,
I am trying to use the
AppleErrorenum in a runtime check, which looks something like this:The issue is that while the typechecking passes,
AppleErrorenum is not available at runtime as it'sdeclaredinreact-native-apple-authentication/lib/index.d.ts
Line 131 in cadd7ca
However, the code is correctly assigned in the error:
This also affects all the other
declaredenums on that file too. I think the easiest fix would be removing thedeclarekeyword from the typedef or marking them asconstinstead.