Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dishait/m-type-tools
通用 ts 的类型工具
https://github.com/dishait/m-type-tools
deno easy helper shared typescript
Last synced: about 2 months ago
JSON representation
通用 ts 的类型工具
- Host: GitHub
- URL: https://github.com/dishait/m-type-tools
- Owner: dishait
- License: mit
- Created: 2022-05-26T06:20:10.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-02-28T04:03:47.000Z (11 months ago)
- Last Synced: 2024-11-11T19:11:41.710Z (about 2 months ago)
- Topics: deno, easy, helper, shared, typescript
- Language: TypeScript
- Homepage:
- Size: 99.6 KB
- Stars: 1
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# m-type-tools
通用 `ts` 的类型工具
## 使用
### 安装
```shell
pnpm i m-type-tools
```
### 类型判断
```ts
import { isString } from 'm-type-tools'isString('foo') // true
isString(1) // false
let bar: any = 'bar'
if (isString(bar)) {
bar.toLowerCase() // 类型正确的
}
```
### 获取类型
```ts
import type { UnArray } from 'm-type-tools'type Foo = UnArray // number
type Bar = UnArray // string
```更多的类型工具可见 👉 [源码](./src)
## `Deno` 支持
由 [udeno](https://github.com/dishait/udeno) 提供开箱支持
```ts
import { isString } from 'https://deno.land/x/[email protected]/mod.ts'
```
## 组织 🦔
欢迎关注 **帝莎编程**
- [官网](http://dishaxy.dishait.cn/)
- [Gitee](https://gitee.com/dishait)
- [Github](https://github.com/dishait)
- [网易云课堂](https://study.163.com/provider/480000001892585/index.htm?share=2&shareId=480000001892585)
## License
Made with [markthree](https://github.com/markthree)
Published under [MIT License](./LICENSE).