¿TypeScript support?
Hi, ¿what would you think about TypeScript in the generator? People would generate robust applications with full rich intellisense and more!
Let me now in order to make a pull request.
Thank you!
Can you explain what adding TypeScript support would look like? I guess you can make a PR if that is easier than explaining the idea, though I'm not saying we'd accept the PR, since I don't understand what it would entail.
Hi @dougwilson, the reason is for a better Javascript writing. I mean, with types support you know what you are writing, you can get intellisense from request and response objects, also for Router object, and so on. I'm not saying replace the Javascript generator, because not all like Typescript; but in other hand other people do, and them (even me) would start a express project with Typescript out of the box.
Hi @sant123 , sorry, I guess I didn't ask right :) So what I was asking was what the code would look like to add the TypeScript support here. I don't really have any TypeScript experience, so wouldn't be able to implement this functionality myself, so I'm not sure how to really proceed even if we wanted this.
Not sure if it's what @sant123 was trying to say, but perhaps he meant a TypeScript-ified version of the presently generated files? I read a blog post here: http://brianflove.com/2016/11/08/typescript-2-express-node/ where the author essentially recreates the seed project but with classes and typing.
I know I would be interested in something like that - the context for me is coming from an Angular front end world and looking for a server to back it. Staying with TypeScript has a lot of appeal for back end development, so a generator that provides the basic wiring (typings and a compile step I guess?) would be cool.
Supporting TypeScript basically means changing the generated files from plain JavaScript to TypeScript. You can see an example for an Express-TypeScript seed here: https://github.com/lokeshthegenius/express-typescript-gulp-seed
The following steps should be made:
-
Change the template files to match TypeScript syntax (add types to functions, ES2015 modules and etc)
-
Add typecsript to devDependencies in the package.json, and change the npm start script
-
Add --typescript argument that will use the above templates instead of the regular JS templates
Many people use TypeScript nowadays, so in my opinion that's kind of a must have feature.
As well as the above an agreed upon tslint.json and tsconfig.json would be necessary. So some thought regarding Typescript standards for express is also required.
Well, TypeScript is getting more and more popular, and I think it will be a nice addition to the generator.
@dougwilson, will you accept a PR?
Any info about this topic?
👍 This would be really nice, somebody have something?
So, with this problem, I came up with a solution, create-ts-api. here the github repo and link to npm registry.
Feel free to raise an issue for more improvements...