The Types module defines shared, platform-agnostic TypeScript contracts used across the Ping Identity React Native SDK ecosystem. It contains types only and ships no runtime logic or native bindings.
Add the package to your workspace:
yarn add @ping-identity/rn-types
All native module rejections are surfaced as PingError instances, which extend the standard
Error class and carry structured fields from the native bridge:
import { PingError } from '@ping-identity/rn-types';
try {
await someOperation();
} catch (err) {
if (err instanceof PingError) {
console.log(err.code, err.type, err.message, err.status);
}
}
Each feature package exports its own subclass of PingError, enabling per-package instanceof
narrowing. Use PingError as the common base when a single catch handles errors from multiple
packages:
import { PingError } from '@ping-identity/rn-types';
export class BrowserError extends PingError {
constructor(message: string, code: string, type: string, status?: number) {
super(message, code, type, status);
this.name = 'BrowserError';
Object.setPrototypeOf(this, new.target.prototype);
}
static from(raw: unknown): BrowserError { ... }
}