Nextcloud-vue: [FR]: TypeScript support

Created on 29 Jan 2020  路  5Comments  路  Source: nextcloud/nextcloud-vue

It would be very beneficial to add TypeScript support through a declaration file. I am currently working on porting my app to Vue.js based on TypeScript. I personally feel lot more comfortable with TS than plain JS and I think it might support other app devs as well, when they think about using this shared component lib.

discussion

Most helpful comment

Hi @skjnldsv.
I think there are a few things to consider:
Even though you don't have to use TS in your app, you can benefit from typings because of IDE autocompletion and checks based on them. So especially for libraries there is a benefit.

I'm not very familiar with authoring a component library or libraries that provide typings in general, so I can't say, if this is a big deal (considered the limited time). I think there are some alternatives:

  1. Refactor / Rewrite the lib in TS to get types strongly connected to the code (lot of work initially; maybe some more work when developing in the future; potential contributors could be daunted, because they don't know TS, but on the other hand could also benefit from the typings, when contributing, because they'd get a lot more feedback directly, if everything fits code-wise)
  2. Provide the declaration files loosely within the repo. (not much work initially; should be considered whenever something is changed API-wise; contributors might ignore this, but maybe no TS knowledge is needed to contribute)
  3. Add typings to DefinitelyTyped. Much more loose from the repo. (like 2, but worse?)

I mean, as I am developing my app in TS anyway, I will have to provide some kind of declaration anyway within my project. Still, I won't type everything - just what I use / need.
I think it should be considered, moreover because Vue itself moves in the direction of TypeScript with version 3. This of course doesn't mean you'd have to use it in the future, but the community will be much more aware of it in the future, I guess.

Just my two cents.

All 5 comments

Hi @janis91. Thanks for raising this question!
Typescript rise the level entry rather quite high. We talked about it before and decided to not use it for our apps. Nonetheless, we do use it for our libraries @nextcloud/xxxxxx. So this questions is an interesting one to ask ourselves for the components library.

We don't get much contributors here and some components are already quite complicated.
How much work do you estimate to implement this here? Because we're all running on limited ressources and it's something to consider in the balance :)

cc @ChristophWurst @nextcloud/vuejs

Hi @skjnldsv.
I think there are a few things to consider:
Even though you don't have to use TS in your app, you can benefit from typings because of IDE autocompletion and checks based on them. So especially for libraries there is a benefit.

I'm not very familiar with authoring a component library or libraries that provide typings in general, so I can't say, if this is a big deal (considered the limited time). I think there are some alternatives:

  1. Refactor / Rewrite the lib in TS to get types strongly connected to the code (lot of work initially; maybe some more work when developing in the future; potential contributors could be daunted, because they don't know TS, but on the other hand could also benefit from the typings, when contributing, because they'd get a lot more feedback directly, if everything fits code-wise)
  2. Provide the declaration files loosely within the repo. (not much work initially; should be considered whenever something is changed API-wise; contributors might ignore this, but maybe no TS knowledge is needed to contribute)
  3. Add typings to DefinitelyTyped. Much more loose from the repo. (like 2, but worse?)

I mean, as I am developing my app in TS anyway, I will have to provide some kind of declaration anyway within my project. Still, I won't type everything - just what I use / need.
I think it should be considered, moreover because Vue itself moves in the direction of TypeScript with version 3. This of course doesn't mean you'd have to use it in the future, but the community will be much more aware of it in the future, I guess.

Just my two cents.

I think it should be considered, moreover because Vue itself moves in the direction of TypeScript with version 3.

Some reading about this? :)

The codebase is also now written in TypeScript. Although this will make proficiency in TypeScript a pre-requisite for contributing to the new codebase, we believe the type information and IDE support will actually make it easier for a new contributor to make meaningful contributions.

Thanks for the read @janis91 :)

Was this page helpful?
0 / 5 - 0 ratings

Related issues

nicolad picture nicolad  路  4Comments

ChristophWurst picture ChristophWurst  路  7Comments

roadrunnerjb picture roadrunnerjb  路  5Comments

raimund-schluessler picture raimund-schluessler  路  3Comments

rullzer picture rullzer  路  7Comments