function isAlchemyConnectionConfig(
value,
): value is { apiKey?: string; jwt?: string; url?: string };Defined in: packages/common/src/transport/connectionSchema.ts:141
Type guard to check if a value is a valid Alchemy connection config.
const maybeConfig: unknown = { apiKey: "test" };
if (isAlchemyConnectionConfig(maybeConfig)) {
// TypeScript knows maybeConfig is AlchemyConnectionConfig here
if (maybeConfig.apiKey) {
console.log("Using API key:", maybeConfig.apiKey);
}
if (maybeConfig.url) {
console.log("Using custom URL:", maybeConfig.url);
}
}| Parameter | Type | Description |
|---|---|---|
|
| The value to check for validity |
value is { apiKey?: string; jwt?: string; url?: string }
True if the value is a valid Alchemy connection config