0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

.vueのインポートでCannot find module or its corresponding type declarations.

Last updated at Posted at 2023-10-05

目的

.vueのインポートでCannot find module or its corresponding type declarations.
になるので回避したいです。

@エイリアスを疑う

@エイリアスの問題ではないです。
tsconfigでは正しく設定されていました。

tsconfig
{
"baseUrl": ".",
"paths": {
      "~/*": [
        "./*"
      ],
      "@/*": [
        "./*"
      ]
    },}

shims-vue.d.tsを宣言

shimsとは
特定の非標準のコンテンツやモジュールに対して型情報を"埋める"役割を果たします。

こちらより、以下の型定義ファイルを宣言することで解決しました。
Cannot import from a typescript Vue component into another typescript Vue component

shims-vue.d.ts
declare module "*.vue" {
  import Vue from "vue";
  export default Vue;
}

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?