davestewart / vuex-pathify

Vue / Vuex plugin providing a unified path syntax to Vuex stores
https://davestewart.github.io/vuex-pathify
MIT License
1.37k stars 57 forks source link

Typescript typings file #7

Closed davestewart closed 5 years ago

davestewart commented 6 years ago

Can anyone help with generating a working typescript typings file?

Any also, what to do with it!? 😝

I got as far as this with a generator and some guessing:

/** Declaration file generated by dts-gen */

// component helpers
export function get(path: string, props?: string[] | object): Function | Object;

export function set(path: string, props?: string[] | object): Function | Object;

export function sync(path: string, props?: string[] | object): Function | Object;

// store helper
export namespace make {
    function actions(state: object, only?: string | string[] | object): object;

    function getters(state: object, only?: string | string[] | object): object;

    function mutations(state: object, only?: string | string[] | object): object;
}

// Payload class
export class Payload {
    constructor(path: string, value: any);

    update(target: object): void;
}

// vuex aliases
export function commit(...args: any[]): void;

export function dispatch(...args: any[]): void;
monsdroid commented 6 years ago

Hi, im veryvery new to typescript andy basicly dont know what i am doing so... for make this works for me (just copy&pasted from vuex definitions)

import {ActionTree, GetterTree, MutationTree} from 'vuex'

export namespace make {
        function actions<S, R>(state: S, only?: string | string[] | object): ActionTree<S, R>;

        function getters<S, R>(state: S, only?: string | string[] | object): GetterTree<S, R>;

        function mutations<S>(state: S, only?: string | string[] | object): MutationTree<S>;
    }
davestewart commented 6 years ago

I just released my first TS project actually, so I have more than "no idea" now, which I did when this ticket was raised!

I'll try to take a look over the weekend

sandiprb commented 6 years ago

hey @davestewart, I can take this up probably, How are you looking to integrate ts?

davestewart commented 6 years ago

Hey Sandip!

Thanks for the offer of help.

Since originally posting, I've been working with TS on a regular basis, though not sure I have the understanding yet to build a typings file!

So maybe to start with, why don't you tell me what I need?

ozum commented 5 years ago

@davestewart, I committed #38 and I hope it solves this issue completely.

Kind Regards,

davestewart commented 5 years ago

Awesome! I've commented in the PR