Hi Jonathan, Thanks for the suggestion! Just take a quick look at this tool and I think it will be very useful!
On Tue, Oct 29, 2019 at 8:43 PM Jonathan Avila <avilajonat...@gmail.com> wrote: > Love this idea. Typescript would be immensely helpful with Echart's > declarative approach. Not sure how you would like to manage the builds, but > to get started, this library may be helpful: > https://github.com/jaredpalmer/tsdx. > > Thanks, > > Jonathan > > On Tue, Oct 29, 2019 at 3:08 AM Yi Shen <shenyi....@gmail.com> wrote: > > > Hi, > > > > It's a very big topic and may sound terrifying. > > > > I started this discussion because I'm using TypeScript a lot recently. > And > > realized a strong typing system really helps a lot when writing the code. > > So I'm thinking about if we can refactor our code with TypeScript. > > > > Of course, there will be a lot of work for the whole codebase. So I > > suggested separating the process into 4 steps, and hopefully, this can be > > done progressively: > > > > 1. The easiest part, create a new branch and renaming all the files from > > .js to .ts. If everything goes well, we can use TS compiler to compile > > these files already. > > 2. Add typings for our fundamental modules. Like `List`, `Graph`, > > `graphic`, `View`, `Model` etc...These modules will be used in almost all > > components. > > 3. We can add typings in our components, which has the most of the logic > > code. > > 4. Adjust our code structure to be more TypeScript. > > > > Personally speaking, the first 3 steps the most needed. It looks to be > > easy, but during the process of adding typings. We may need to rewrite a > > lot of code to meet the purpose of strong typing. > > > > Here are some pros and cons of changing the code to TypeScript I can > think > > of: > > > > Pros are mostly come from strong typing: > > 1. We can avoid bugs like argument mismatching [1], variable naming typo > > Bugs like these easily happen when we are refactoring the code. I can > find > > a lot of commits about fixing the typos [2]. > > 2. Developers know what the interfaces look like of each module, which > > makes it easier for them to contribute. > > 3. VSCode has a really wonderful intelligence on the TypeScript. I enjoy > it > > a lot when I'm writing TypeScript. > > > > Cons: > > 1. Honestly speaking, it's a lot of work. And it's hard to keep the > > TypeScript branch updated with the master branch before merging. > > 2. Developers may need to learn TypeScript. But I think it's not a big > deal > > comparing to learning how echarts works. > > > > At last, as I said first, the word refactoring may sound terrifying. But > I > > believe it worth it. I hope we can all enjoy writing our code with the > help > > of excellent intelligence. > > > > Regards > > > > [1] https://github.com/ecomfe/zrender/pull/480 > > [2] > https://github.com/apache/incubator-echarts/search?q=typo&type=Commits > > > > -- > > Yi Shen > > Apache ECharts(incubating) PPMC > > > -- Yi Shen Apache ECharts(incubating) PPMC