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.

[vue3、typescript]v-calendarのimport時にエラー

Last updated at Posted at 2023-09-21

環境

vscode 1.82.2

vue 3.3.4
typescript 5.1.6
vite 4.4.9

v-calendar 3.0.3

手順

1.以下からnpmでインストール
VCalendar

npm install v-calendar@next @popperjs/core

2.main.tsで使用するコンポーネントをimport

main.ts
import { Calendar, DatePicker } from 'v-calendar';
...
app.component('Calendar', Calendar)
app.component('DatePicker', DatePicker)

現象

以下のエラーが発生。

モジュール 'v-calendar' の宣言ファイルが見つかりませんでした。'.../index.jsは暗黙的に 'any' 型になります。
There are types at '.../index.d.ts', but this result could not be resolved when respecting package.json "exports". The 'v-calendar' library may need to update its package.json or typings.ts(7016)

原因

型定義ファイル(d.ts)がないことが原因だった。

対策

作業ディレクトリに定義ファイルである@types/v-calendarを追加。

v-calendar.d.ts
declare module 'v-calendar'

・その他試したこと(失敗)
npmで@types/v-calendarをインストール。
用意されていませんでした。

npm install @types/v-calendar

参考サイト

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?