# hasproperty-ts

> If the object property check is successful, the object type including the target property is generated.

Latest version **0.0.3** (published 2019-11-06) · MIT license · 0 weekly downloads

## Install

```sh
npm install hasproperty-ts
pnpm add hasproperty-ts
yarn add hasproperty-ts
bun add hasproperty-ts
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2019-11-06 |
| First published | 2019-11-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2 |
| Author | SoraKumo |
| Maintainers | sora_kumo |
| Keywords | typescript |

## Links

- npm: https://www.npmjs.com/package/hasproperty-ts
- Repository: https://SorakKumo001:Network1+@github.com/npm-packages01/hasproperty-ts
- Homepage: https://ttis.croud.jp/
- Issues: https://github.com/npm-packages01/hasproperty-ts/issues
- npm.io page: https://npm.io/package/hasproperty-ts

## 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

- 0.0.3 (latest) — 2019-11-06
- 0.0.2 — 2019-11-06
- 0.0.1 — 2019-11-06

## README

# hasproperty-ts

If the object property check is successful, the object type including the target property is generated.

## If you do not use this package

```ts
function Test(x:unknown){
  if(x instanceof Object && "foo" in x){
    console.log(x.foo); //Error
    console.log((<{foo:unknown}>x).foo); //OK(Cast required)
  }
}
```

## When using this package

```ts
import {hasProperty} from "hasproperty-ts";

function Test(x: unknown) {
  if (hasProperty(x, "foo")) {
    console.log(x.foo); //TypeScript Type OK
  }

  if (hasProperty2(x, "foo", "bar")) {
    console.log(x.foo); //TypeScript Type OK
    console.log(x.bar); //TypeScript Type OK
  }
}
```

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