-
Notifications
You must be signed in to change notification settings - Fork 230
Open
Description
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) // undefinedHowever, 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.
Metadata
Metadata
Assignees
Labels
No labels