Vue + TypeScript + CSS module
You need to augment the Vue typings. Create a declaration file (like sfc.d.ts
) and add the following:
// 1. Make sure to import 'vue' before declaring augmented typesimport Vue from 'vue'// 2. Specify a file with the types you want to augment// Vue has the constructor type in types/vue.d.tsdeclare module 'vue/types/vue' { // 3. Declare augmentation for Vue interface Vue { $style: any }}
Change any
to match the type declaration of $style
, for example:
$style: { [key: string]: string }