Files
SnowLuma/.pnpm-store/v11/files/09/0fcc204c2b6566e2f4735efc7eb8127131f3147f8e5083f3b9806f223df505a620118305a0dd33073782d76cbeb326aad242c122dfc96dd6ef5df5a53a1738
T
TanTan 2a69b23b47
Dev Build / cleanup (push) Canceled after 0s
Dev Build / typecheck (push) Canceled after 0s
Dev Build / build (linux-arm64, ubuntu-24.04-arm, linux-arm64) (push) Canceled after 0s
Dev Build / build (linux-x64, ubuntu-latest, linux-x64) (push) Canceled after 0s
Dev Build / build (win-x64, windows-latest, win32-x64) (push) Canceled after 0s
Dev Build / dispatch-dev-docker (push) Canceled after 0s
docs: 仓库链接指向本镜像仓库
2026-11-13 09:27:07 +08:00

23 lines
614 B
Plaintext

/**
* Ensure the type of a value
*
* 确认类型
*
* @example
* ```js
* import { ensureType } from 'is-what-type';
*
* const value: string | number | boolean | null | undefined | symbol | bigint = null;
const whatType = typeof value;
if (ensureType<object>(value, whatType === 'object')) {
Object.keys(value); // Throws TypeError: Cannot convert undefined or null to object
}
* ```
*
* @param value - The value to check
* @param checked - If the type is already checked
* @returns
*/
export declare function ensureType<T = unknown>(value: unknown, checked: boolean): value is T;