vorpal icon indicating copy to clipboard operation
vorpal copied to clipboard

TypeScript Definition Files

Open jimbuck opened this issue 8 years ago • 18 comments

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?

jimbuck avatar Jul 12 '16 19:07 jimbuck

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

dthree avatar Jul 13 '16 20:07 dthree

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.

jimbuck avatar Jul 13 '16 21:07 jimbuck

Oh, nice! Good point.

dthree avatar Jul 14 '16 02:07 dthree

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

wendellmva avatar Aug 27 '16 14:08 wendellmva

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 avatar Aug 29 '16 23:08 jimbuck

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

jimbuck avatar Aug 30 '16 13:08 jimbuck

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

vincentsong avatar Oct 13 '16 03:10 vincentsong

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

k0pernikus avatar Nov 17 '16 17:11 k0pernikus

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!

jimbuck avatar Nov 17 '16 19:11 jimbuck

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

cdekok avatar Nov 21 '16 20:11 cdekok

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

jimbuck avatar Nov 21 '16 20:11 jimbuck

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

slavafomin avatar Apr 29 '17 16:04 slavafomin

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

maxime1992 avatar Nov 19 '17 22:11 maxime1992

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 avatar Nov 21 '17 01:11 jimbuck

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!

jimbuck avatar Nov 28 '17 16:11 jimbuck

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 avatar Feb 09 '18 08:02 amir-arad

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 avatar Feb 09 '18 08:02 amir-arad

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

amir-arad avatar Feb 09 '18 08:02 amir-arad