wraith/node_modules/is-what/dist/isInstanceOf.d.ts
Vantz Stockwell 2848d79915 feat: Phase 1 complete — Tauri v2 foundation
Rust backend: SQLite (WAL mode, 8 tables), vault encryption
(Argon2id + AES-256-GCM), settings/connections/credentials
services, 19 Tauri command wrappers. 46/46 tests passing.

Vue 3 frontend: unlock/create vault flow, Pinia app store,
Tailwind CSS v4 dark theme with Wraith branding.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-03-17 15:09:41 -04:00

24 lines
1.2 KiB
TypeScript

import type { AnyClass } from './isType.js';
type GlobalClassName = {
[K in keyof typeof globalThis]: (typeof globalThis)[K] extends AnyClass ? K : never;
}[keyof typeof globalThis];
/**
* Checks if a value is an instance of a class or a class name. Useful when you want to check if a
* value is an instance of a class that may not be defined in the current scope. For example, if you
* want to check if a value is an `OffscreenCanvas` instance, you might not want to do the song and
* dance of using `typeof OffscreenCanvas !== 'undefined'` and then shimming `OffscreenCanvas` if
* the types aren't around.
*
* @example
* if (isInstanceOf(value, 'OffscreenCanvas')) {
* // value is an OffscreenCanvas
* }
*
* @param value The value to recursively check
* @param class_ A string or class that the value should be an instance of
*/
export declare function isInstanceOf<T extends AnyClass>(value: unknown, class_: T): value is T;
export declare function isInstanceOf<K extends GlobalClassName>(value: unknown, className: K): value is (typeof globalThis)[K];
export declare function isInstanceOf(value: unknown, className: string): value is object;
export {};