Skip to content
This repository has been archived by the owner on Jan 3, 2023. It is now read-only.

Adding Typescript #271

Closed

Conversation

georgeedwards
Copy link

Just a proposal for how to add TS support to the cli. Not ready yet, but opening this as somewhere to discuss the work. Would love to hear what you think.

I have done some work on app initial generation, which generates fine. There are some compilation errors, but they will be solved when the feathers-error patch is merged and released.

I have also done some work on the authentication function. But I believe the feathers g authentication command is "launched by the core cli project, so I'll need to create a version of the cli which has my dev generator as a dependancy to test this? My only query on this (I am not particularly familiar with developing with Yeoman), is that currently you are asked what language you want to use on every command. Is there any way to make your answer persist?

@daffl
Copy link
Member

daffl commented Sep 7, 2017

Thank you @georgeedwards! Definitely worth investigating more. Two things I can think of at the moment:

  • Are there codemods that support TypeScript? We are using JSCodeshift and although we do eventually want to update them to use the es module syntax, they are quite tricky to maintain and we might have some investigating to do if they support TypeScript.
  • Could this live in a separate repository? Will there be more than one maintainer? The TS version of the application needs to be kept in sync with its JavaScript equivalent. Since none of the current maintainers of the generator repository are using TypeScript we need someone in charge of this.

@georgeedwards
Copy link
Author

@daffl Thanks. As for codemods - this is what I am focusing on now. There is tscodeshift which looks promising, but needs work to expose the API we need. Additionally jscodeshift may support TypeScript which would obviously be a better outcome, so I am waiting to see how viable that is.

As for could it live in a second repo, would that mean having a feathers and a feathers.ts cli? Obviously having a feathers cli which supports TypeScript would be better for the TS community, but I guess that the TS community has been a little flaky and you don't want to be landed with something you can't support?

As for maintainers - obviously I'll be happy to do this, but for a second one, I don;t know if any of - @j2L4e @myknbani @jonlambert @harish2704 @eddyystop @ForsakenHarmony @rjsteinert @jsgoupil @AbraaoAlves @stevehipwell @Harangue

would be interested in helping??

@j2L4e
Copy link
Contributor

j2L4e commented Sep 7, 2017

Happy to help with fixes of typings etc.
I'm also generally willing to help maintain it, yet I'm afraid I don't have spare time to pour into the generator at the moment. At least not into the initial effort that it'll take.

@georgeedwards
Copy link
Author

georgeedwards commented Sep 7, 2017

Awesome - well I am happy to lead the initial dev effort. In fact, does anyone have a minimal Feathers example using TypeScript they would be willing to share? It would certainly be good to see how people would like to be using it. At the moment, I am being slowed down by troubleshooting my generated typescript's issues with exports and types e.g.

TypeError: fn.call is not a function
TS2306: File './src/services/index.ts' is not a module

etc. All fixable but a bit boring, so I am focussing on the AST transformations and an alternative to jscodeshift at the moment.

@daffl
Copy link
Member

daffl commented Oct 26, 2017

@georgeedwards I'll close this for now. It would still be great to see a TS fork of the generator but I have the feeling this might be much easier once it works with ES modules (the automated codemods are the tricky part here). It probably also makes more sense to have it in a separate repository.

Working with @j2L4e on the definitions for v3 at the moment over at https://github.com/feathersjs-ecosystem/feathers-typescript so hopefully once that is completed and the generator supports ES modules this can be looked into again more.

@daffl daffl closed this Oct 26, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants