vorpal
vorpal copied to clipboard
TypeScript Definition Files
Has anyone started to create TypeScript definitions for Vorpal? I am going to start (since this library is worth the extra work), but wanted to see if anyone already begun.
@dthree Any preference as to where the definitions live? PR here or in DefinitelyTyped?
@JimmyBoh No, no one has done that yet, as far as I am aware. Thanks! You should put them in DefinitelyTyped.
Cool! My pleasure.
The nice thing is that a lot of the work has already been done since you are using InquirerJS, so those definitions will automatically carry-over.
Oh, nice! Good point.
uhm what's the status of those vorpal dt's?
Sadly I have not started on them. But I have relearned the majority of the API(forgot a lot since the last time I used it), so I should be able to get a very basic file set up with the most common methods. I will work on them tonight and get them pushed out. Then make incremental updates.
So as promised I did get a basic definition file started, but it is far from ready. I will try to work on it some more and get all the data structures in place today. Once I have the bulk of the API laid out I will make a PR to @DefinitelyTyped. Then we can go back to add the doc comments and any missed methods.
Basic process so far:
I am working with VisualStudio Code, the dt is really helpful. This task is really handy for me.
@JimmyBoh @dthree It'd be awesome for the typings to live in the @types
package on npm, so that one could simply run npm install @types/vorpal
. As of typescript2, one doesn't need typings anymore.
Actually @k0pernikus, the @types namespace on npm
is automatically populated from the DefinitelyTyped repo. But it does mean one less tool to mess with, goodbye typings
!
would be nice if they pull request can be done? something still missing from the definition file ?
@cdekok Yeah, a lot of testing and deeper APIs must be added. I will take a look tonight. Does anyone know how DefinitelyTyped feels about partial definitions?
Hello! Just curious, has anyone finished typings for vorpal?
I'm also really interested in Vorpal's typings :) Any news @JimmyBoh ?
I actually forget where I was at with that! I will look into where I left off and will update here. I've been busier than usual with projects that pay the bills, but I should have some free time coming up!
So I pulled down my latest and blew the dust off. There is a decent amount that is done but I need to go back and check the latest of Vorpal to make sure everything makes sense. For those interested the typings are in the vorpal-typings
branch of my DefinitelyTyped repo. Please feel free to fork the branch if you want to help!
Hi, I'm using the vorpal-typings and extending it as I go. I'm using typescript strict-mode so I made it pass strict checks. this is where I keep it for now.
also, had a really hard time supporting the require('vorpal')()
api, so I'm only declaring the
new (require('vorpal'))()
api. works the same, closer to ES6, and good enough for me.
usage example:
import Vorpal = require('vorpal');
import {Args, CommandInstance} from "vorpal";
const vorpal = new Vorpal();
vorpal
.command('query', 'Queries the server')
.action(async function (this: CommandInstance, args: Args) {
this.log('query');
});
vorpal
.delimiter('epsilon$')
.show();