# @se-oss/typeof

> A robust utility for determining the runtime type of any JavaScript value.

Latest version **1.1.0** (published 2026-01-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @se-oss/typeof
pnpm add @se-oss/typeof
yarn add @se-oss/typeof
bun add @se-oss/typeof
```

## Health

**Score 65/100 (B)** — status: stable.

Positive: has types; esm support; no vulnerabilities; has provenance; high quality score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.1.0 |
| Published | 2026-01-07 |
| First published | 2025-12-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 16.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 3 |
| Author | Shahrad Elahi |
| Maintainers | shahradelahi |
| Keywords | typeof, kind-of, type, check, typescript |

## Links

- npm: https://www.npmjs.com/package/@se-oss/typeof
- Repository: https://github.com/shahradelahi/ts-typeof
- Issues: https://github.com/shahradelahi/ts-typeof/issues
- npm.io page: https://npm.io/package/@se-oss/typeof

## Alternatives

- [@openai/codex-sdk](https://npm.io/package/@openai/codex-sdk.md) — 731.4K weekly downloads
- [babel-plugin-transform-react-jsx](https://npm.io/package/babel-plugin-transform-react-jsx.md) — 565.0K weekly downloads
- [babel-helper-remove-or-void](https://npm.io/package/babel-helper-remove-or-void.md) — 508.5K weekly downloads
- [@pnpm/store-controller-types](https://npm.io/package/@pnpm/store-controller-types.md) — 186.9K weekly downloads
- [react-native-signature-canvas](https://npm.io/package/react-native-signature-canvas.md) — 155.6K weekly downloads

## Recent versions

- 1.1.0 (latest) — 2026-01-07
- 1.0.0 — 2025-12-26

## README

# @se-oss/typeof

[![CI](https://github.com/shahradelahi/ts-typeof/actions/workflows/ci.yml/badge.svg?branch=main&event=push)](https://github.com/shahradelahi/ts-typeof/actions/workflows/ci.yml)
[![NPM Version](https://img.shields.io/npm/v/@se-oss/typeof.svg)](https://www.npmjs.com/package/@se-oss/typeof)
[![MIT License](https://img.shields.io/badge/License-MIT-blue.svg?style=flat)](/LICENSE)
![npm bundle size](https://img.shields.io/bundlephobia/minzip/@se-oss/typeof)
[![Install Size](https://packagephobia.com/badge?p=@se-oss/typeof)](https://packagephobia.com/result?p=@se-oss/typeof)

_@se-oss/typeof_ is a robust utility for determining the runtime type of any JavaScript value.

---

- [Installation](#-installation)
- [Usage](#-usage)
- [Documentation](#-documentation)
- [Contributing](#-contributing)
- [License](#license)

## 📦 Installation

```bash
npm install @se-oss/typeof
```

<details>
<summary>Install using your favorite package manager</summary>

**pnpm**

```bash
pnpm install @se-oss/typeof
```

**yarn**

```bash
yarn add @se-oss/typeof
```

</details>

## 📖 Usage

### Basic Usage

```typescript
import { typeOf } from '@se-oss/typeof';

typeOf(undefined); // 'undefined'
typeOf(null); // 'null'
typeOf(true); // 'boolean'
typeOf('hello'); // 'string'
typeOf(123); // 'number'
typeOf([]); // 'array'
typeOf({}); // 'object'
typeOf(new Date()); // 'date'
typeOf(/abc/); // 'regexp'
```

### TypeScript Support

The library provides a `TypeOf<T>` conditional type that maps TypeScript types to their runtime string representations.

```typescript
import type { TypeOf } from '@se-oss/typeof';

type MyType = TypeOf<string>; // 'string'
type MyDate = TypeOf<Date>; // 'date'
```

The `typeOf` function also utilizes this type for better return type inference:

```typescript
const result = typeOf('hello'); // Inferred as 'string'
```

## 📚 Documentation

For all configuration options, please see [the API docs](https://www.jsdocs.io/package/@se-oss/typeof).

## 🤝 Contributing

Want to contribute? Awesome! To show your support is to star the project, or to raise issues on [GitHub](https://github.com/shahradelahi/ts-typeof).

Thanks again for your support, it is much appreciated! 🙏

## License

[MIT](/LICENSE) © [Shahrad Elahi](https://github.com/shahradelahi) and [contributors](https://github.com/shahradelahi/ts-typeof/graphs/contributors).

---
_Source: https://npm.io/package/@se-oss/typeof · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
