better-typescript-lib:更好的TypeScript标准库

时间:2021-03-19 22:39:50
【文件属性】:
文件名称:better-typescript-lib:更好的TypeScript标准库
文件大小:51KB
文件格式:ZIP
更新时间:2021-03-19 22:39:50
typescript TypeScript 更好的打字稿库 具有更好类型定义的替代TypeScript标准库。 问题 众所周知,由于存在any其他陷阱,TypeScript并不是非常安全的类型,但TypeScript的内置类型定义也应归咎于这种不安全性。例如,将JSON.parse的返回类型设置为any是很方便的,但是非常不安全。 理想地,考虑到类型安全性,TypeScript的内置类型定义应该更好,但是如果考虑到向后兼容性,这几乎是不可能的。 解决方案 这个包提供了一个替代的类型定义,它比TypeScript的内置类型定义更安全。使用此程序包,TypeScript用户获得意外获取any值的机会更少。例如,在此类型定义中, JSON.parse的返回类型不是any ,而是代表所有可能的JSON数据的JSONData 。 该软件包还包括其他改进的,更严格的类型定义。 用法 安装 npm i -D better-typescript-l
【文件预览】:
better-typescript-lib-master
----.gitignore(33B)
----package-template()
--------package.json(323B)
----package.json(617B)
----package-lock.json(64KB)
----build()
--------build.ts(3KB)
--------replacement.ts(1KB)
--------package.ts(1KB)
----LICENSE(11KB)
----CHANGELOG.md(103B)
----tsconfig.json(6KB)
----.gitmodules(95B)
----.github()
--------workflows()
----README.md(2KB)
----tests()
--------esnext.string.ts(266B)
--------es2015.core.ts(764B)
--------es2019.object.ts(503B)
--------es2017.object.ts(891B)
--------es5.ts(3KB)
--------tsconfig.json(203B)
--------esnext.promise.ts(189B)
--------es2015.proxy.ts(673B)
--------es2015.collection.ts(1KB)
--------es2015.reflect.ts(401B)
--------es2015.promise.ts(1KB)
--------es2015.iterable.ts(1KB)
--------index.d.ts(0B)
----lib()
--------lib.esnext.promise.d.ts(160B)
--------lib.es2015.reflect.d.ts(1KB)
--------lib.es2015.iterable.d.ts(1KB)
--------lib.es2015.proxy.d.ts(917B)
--------lib.es2018.asyncgenerator.d.ts(551B)
--------lib.es2015.promise.d.ts(2KB)
--------util.d.ts(195B)
--------lib.es5.d.ts(9KB)
--------lib.es2018.asynciterable.d.ts(440B)
--------lib.es2019.object.d.ts(370B)
--------lib.es2015.collection.d.ts(2KB)
--------lib.es2015.generator.d.ts(473B)
--------lib.esnext.string.d.ts(824B)
--------lib.es2017.object.d.ts(1KB)
--------lib.es2015.core.d.ts(7KB)
----.vscode()
--------settings.json(74B)
----TypeScript()
----.editorconfig(53B)
----.prettierrc(2B)
----index.d.ts(0B)

网友评论