dthree / vorpal

Node's framework for interactive CLIs
http://vorpal.js.org
MIT License
5.64k stars 280 forks source link

TypeScript Definition Files #158

Open jimbuck opened 8 years ago

jimbuck commented 8 years ago

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?

dthree commented 8 years ago

@JimmyBoh No, no one has done that yet, as far as I am aware. Thanks! You should put them in DefinitelyTyped.

jimbuck commented 8 years ago

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.

dthree commented 8 years ago

Oh, nice! Good point.

wendellmva commented 8 years ago

uhm what's the status of those vorpal dt's?

jimbuck commented 8 years ago

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.

jimbuck commented 8 years ago

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: 103lwnLTBNOxi0

vincentsong commented 8 years ago

I am working with VisualStudio Code, the dt is really helpful. This task is really handy for me.

k0pernikus commented 7 years ago

@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.

jimbuck commented 7 years ago

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!

cdekok commented 7 years ago

would be nice if they pull request can be done? something still missing from the definition file ?

jimbuck commented 7 years ago

@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?

slavafomin commented 7 years ago

Hello! Just curious, has anyone finished typings for vorpal?

maxime1992 commented 6 years ago

I'm also really interested in Vorpal's typings :) Any news @JimmyBoh ?

jimbuck commented 6 years ago

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!

jimbuck commented 6 years ago

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!

amir-arad commented 6 years ago

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.

amir-arad commented 6 years ago

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.

amir-arad commented 6 years ago

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();