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.

Property 'hoge' does not exist on type 'CombinedVueInstance<Vue, unknown, unknown, unknown, Readonly<{ hoge }>>'.と怒られる

Posted at

概要

  • 仕事中nuxtでコードを書いてたら謎のエラーに遭遇して2時間くらい苦戦したので、備忘録のため残しておく

環境

  • nuxt -> 2.15.8
  • @nuxt/typescript-build -> 2.1.0

事象

computed配下の変数に下記のエラー文が出る

Property 'hoge' does not exist on type 'CombinedVueInstance<Vue, unknown, unknown, unknown, Readonly<{ hoge }>>'.

解決方法

  • computedの関数の返り値に型をつける
computed {
  hogeHoge(): string { return hoge}
}
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?