serii81
@serii81
Я люблю phр...

Как решить проблему с typescript в vue3?

Всем привет.
При создании билда появляется ошибка
Could not find a declaration file for module 'vue3-recaptcha2'. '/home/serii/Sites/vue/vue-silcompa/node_modules/vue3-recaptcha2/dist/vue3-recaptcha2.es.js' implicitly has an 'any' type.
  There are types at '/home/serii/Sites/vue/vue-silcompa/node_modules/vue3-recaptcha2/dist_types/index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'vue3-recaptcha2' library may need to update its package.json or typings.


Мой package.json
{
  "name": "vue-silcompa",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "dev": "vite",
    "build": "run-p type-check build-only",
    "preview": "vite preview",
    "build-only": "vite build",
    "type-check": "vue-tsc --noEmit -p tsconfig.app.json --composite false",
    "preinstall": "node -e \"if(process.env.npm_execpath.indexOf('yarn') === -1) throw new Error('You must use Yarn to install, not NPM')\"",
    "predev": "node -e \"if(process.env.npm_execpath.indexOf('yarn') === -1) throw new Error('You must use Yarn to install, not NPM')\""
  },
  "dependencies": {
    "@vuelidate/core": "^2.0.0",
    "@vuelidate/validators": "^2.0.0",
    "pinia": "^2.1.3",
    "vue": "^3.3.4",
    "vue-i18n": "^9.3.0-beta.24",
    "vue-router": "^4.2.2",
    "vue3-cookies": "^1.0.6",
    "vue3-recaptcha2": "^1.8.0"
  },
  "devDependencies": {
    "@tsconfig/node18": "^2.0.1",
    "@types/node": "^18.16.17",
    "@vitejs/plugin-vue": "^4.2.3",
    "@vue/tsconfig": "^0.4.0",
    "node-sass": "^8.0.0",
    "npm-run-all": "^4.1.5",
    "sass": "^1.57.1",
    "sass-loader": "^13.2.0",
    "typescript": "~5.0.4",
    "vite": "^4.3.9",
    "vue-tsc": "^1.6.5"
  },
  "engines": {
    "node": ">=16.0.0"
  },
  "exports": {
    ".": {
      "import": {
        "node": "./index.mjs",
        "default": "./dist/vue-i18n.esm-bundler.js",
        "types": "./dist/vue-i18n.d.ts"
      },
    }
  }
}


У меня в types уже прописан путь до i18n.

Заранее благодарен.
  • Вопрос задан
  • 354 просмотра
Пригласить эксперта
Ответы на вопрос 1
@raiyin
Мне помогло прописать всем свом компонентам атрибут lang="ts" в секции script:
Ответ написан
Комментировать
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы