Giter Club home page Giter Club logo

Comments (6)

yanhaijing avatar yanhaijing commented on May 30, 2024

目前对ts的支持是通过 index.d.ts来实现的,也就是说源代码都是用es来写,给ts增加一个类型定义

库用ts更严谨些

这个我不能赞同,我其实认为业务代码用ts更严谨,但是对于库来说,使用者都是使用编译以后的代码,ts编译以后就是js,对于js用户来说,他们用ts的库会非常痛苦,因为没有了类型,也没有了类型校验

ts版本的也不用考虑低版本兼容的配置

这个我也不太能赞同哦,库开发者需要明确自己的兼容性,兼容性更广,潜在用户就会更多

ts的库,我觉得更建议用户使用ts文件,而不是编译以后的源码,不过我觉得倒是可以在搞一个tslib-base

from jslib-base.

bigmeow avatar bigmeow commented on May 30, 2024

已经用这个写了个js小程序的库,不过我稍微改了下,支持了ts,ts和 eslint有很多重合的地方,这里配置规则很痛苦,所以我粗暴的把vue-cli3的规则拿来用了;
之所以说兼容性的问题,因为现在前端已经不仅仅是web端了,很多历史包袱是抛下的
这是我昨天写的: https://github.com/bigmeow/axios-miniprogram-adapter

from jslib-base.

yanhaijing avatar yanhaijing commented on May 30, 2024

如果可以的话,能否提个pr,如果不方便,那我就参考你的了,可以同时支持js和ts,但二者同时只能选其一吧
你的库,我已经收录了哈

from jslib-base.

bigmeow avatar bigmeow commented on May 30, 2024

我这个还在边使用边完善,我另外一个库也在使用中了,目前抽不出时间把它做成cli命令让用户可选择自己喜欢的配置。因为这种模板性的东西,有个问题要解决比较麻烦,就是用户会选择,比如代码风格规范,每个人可能都不同,想尽善进美就得和提供cli命令了 ,让用户安装时自己可选择,类似于vue-cli 那样。
做开源。。。真不简单啊

对了,还发现加了emoji会更好看,
预览: https://github.com/bigmeow/minapp-api-promise/tree/typescript

from jslib-base.

yanhaijing avatar yanhaijing commented on May 30, 2024

对了,还发现加了emoji会更好看

欢迎提个pr啊

另外ts的我也计划支持了,欢迎提pr哈

cli这个我还在纠结哦,从体验上来说cli更好,但是cli会把细节屏蔽,这不是我想要的,我其实是想让大家来了解下内部细节,因为这样才能共同进步,而不是无脑用这个工具

from jslib-base.

yanhaijing avatar yanhaijing commented on May 30, 2024

@bigmeow 考虑加入jsmini吗?
https://github.com/jsmini

from jslib-base.

Related Issues (15)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.