-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add .d.ts for typescript like vuex #26
Comments
Hey @henrixapp I appreciate your work and from using TypeScript myself for certain projects, I know how nice it is to have the correct types for all of your dependencies. But what concerns me is this: the types have to be updated every time I make some changes – and to be completely honest with you: I don't want to invest my time in that. It even gets more complicated if other people decide to contribute their time, I can't expect every contributor to be familiar with TypeScript. So I decided against adding types in this repository. I'm sorry. But I'd be very happy if you (or anyone else) decides to invest some time and add Thx for contributing! |
The other way to add v-m-f with ts is: import Vue from "vue";
import Vuex from "vuex";
const vuexMapFields = require("vuex-map-fields");
const getField = vuexMapFields.getField;
const updateField = vuexMapFields.updateField;
Vue.use(Vuex);
export default new Vuex.Store({
state: {},
getters: { getField },
mutations: { updateField },
actions: {},
modules: {}
}); |
Hey @maoberlehner ! It seems there is a simpler way to get typings in than to add them to DefinitelyTyped, which has its whole own process and standards. Instead it is recommended by them that, if there is a way to generate these automatically, to just add them to the npm repo:
source: https://github.com/DefinitelyTyped/DefinitelyTyped#create-a-new-package However this can also be done with JS. For generating these typings we just need to add typescript to the devDependencies and add a step in the build scripts which runs typescript with a special config. After that, the type definitions will be provided simply from within the folder All of which has been done here: The auto-generated typings are currently not really the most precise as they will just default to This PR way however avoids needing to create a shim |
Adding a
index.d.ts
would be great in order to support typescript. I have drafted one already, based on the vuex one:Probably the unused types should be removed. Currently it just enables correct typing with
createHelpers
The text was updated successfully, but these errors were encountered: