Comments (6)
目前对ts的支持是通过 index.d.ts来实现的,也就是说源代码都是用es来写,给ts增加一个类型定义
库用ts更严谨些
这个我不能赞同,我其实认为业务代码用ts更严谨,但是对于库来说,使用者都是使用编译以后的代码,ts编译以后就是js,对于js用户来说,他们用ts的库会非常痛苦,因为没有了类型,也没有了类型校验
ts版本的也不用考虑低版本兼容的配置
这个我也不太能赞同哦,库开发者需要明确自己的兼容性,兼容性更广,潜在用户就会更多
ts的库,我觉得更建议用户使用ts文件,而不是编译以后的源码,不过我觉得倒是可以在搞一个tslib-base
from jslib-base.
已经用这个写了个js小程序的库,不过我稍微改了下,支持了ts,ts和 eslint有很多重合的地方,这里配置规则很痛苦,所以我粗暴的把vue-cli3的规则拿来用了;
之所以说兼容性的问题,因为现在前端已经不仅仅是web端了,很多历史包袱是抛下的
这是我昨天写的: https://github.com/bigmeow/axios-miniprogram-adapter
from jslib-base.
如果可以的话,能否提个pr,如果不方便,那我就参考你的了,可以同时支持js和ts,但二者同时只能选其一吧
你的库,我已经收录了哈
from jslib-base.
我这个还在边使用边完善,我另外一个库也在使用中了,目前抽不出时间把它做成cli命令让用户可选择自己喜欢的配置。因为这种模板性的东西,有个问题要解决比较麻烦,就是用户会选择,比如代码风格规范,每个人可能都不同,想尽善进美就得和提供cli命令了 ,让用户安装时自己可选择,类似于vue-cli 那样。
做开源。。。真不简单啊
对了,还发现加了emoji会更好看,
预览: https://github.com/bigmeow/minapp-api-promise/tree/typescript
from jslib-base.
对了,还发现加了emoji会更好看
欢迎提个pr啊
另外ts的我也计划支持了,欢迎提pr哈
cli这个我还在纠结哦,从体验上来说cli更好,但是cli会把细节屏蔽,这不是我想要的,我其实是想让大家来了解下内部细节,因为这样才能共同进步,而不是无脑用这个工具
from jslib-base.
@bigmeow 考虑加入jsmini吗?
https://github.com/jsmini
from jslib-base.
Related Issues (15)
- 【官方】收集使用jslib-base的项目 HOT 2
- npm install jslib-base Error HOT 2
- 切换为TS后, 测试不通过 HOT 3
- Hello! Is there a bug? HOT 4
- rollup 官方月已经升级到 1.8 了,目前 jslib-base 使用到是 0.57.1 版本 HOT 6
- 项目里面不能使用对象扩展的语法. HOT 2
- import() 语法不支持. HOT 3
- 提一个小bug HOT 3
- 代码压缩问题 HOT 2
- jslib 是否可以加上 index.d.ts 的代码声明自动生成 HOT 6
- 关于文档可以选用 jsdoc 来自动生成 HOT 5
- 是否有考虑直接用babel打包成lib/ es/等文件夹。 HOT 9
- 执行npm run release失败 HOT 1
- 创建新库无法默认使用 yarn HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from jslib-base.