Open ZachHaber opened 1 year ago
last fix commit is 2 years , I'm wondering is this package still maintained...
My workaround for the vuex type definition error:
declare module "vuex" {
export * from "vuex/types/index.d.ts";
export * from "vuex/types/helpers.d.ts";
export * from "vuex/types/logger.d.ts";
export * from "vuex/types/vue.d.ts";
}
Save the above code under an appropriate directory with a name like vuex.d.ts
. This should allow TypeScript to correctly recognize the vuex module.
Changing the vuex package.json with :
{
"name": "vuex",
"version": "4.0.2",
...
"exports": {
".": {
"module": "./dist/vuex.esm-bundler.js",
"require": "./dist/vuex.cjs.js",
"import": {
"default": "./dist/vuex.mjs",
"types": [
"./types/index.d.ts",
"./types/helpers.d.ts",
"./types/logger.d.ts",
"./types/vue.d.ts"
]
}
},
},
...
fixes the issue
Hi! 👋
Firstly, thanks for your work on this project! 🙂
Today I used patch-package to patch
vuex@3.6.2
for the project I'm working on.Typescript with nodenext resolution ignores the "typings" property completely when "exports" is specified, which causes typescript to complain that it can't find any type definitions for this package.
https://github.com/microsoft/TypeScript/issues/49160#issuecomment-1137482639
This should work fine on both v3 and v4, since both have the same issue with typescript and the exports object.
Here is the diff that solved my problem:
This issue body was partially generated by patch-package.