vue 反应性变换 $ref 未定义

vch*_*vch 4 vue.js

根据文档中的此页面,宏应该是

全局可用,启用反应性变换时无需导入

我已根据此处的文档明确选择了 vue 配置中的反应性转换:

// vue.config.js
    config.module.rule('vue')
      .use('vue-loader')
      .tap((options) => {
        return {
          ...options,
          reactivityTransform: true
        }
      })
Run Code Online (Sandbox Code Playgroud)

但我是从 eslint 得到的'$ref' is not defined。我想我需要在某个地方启用它,以便 eslint 理解它是一个全局宏,但我在文档中找不到任何有关它的信息。

我缺少什么?

vch*_*vch 9

我设法通过将其添加到来解决这个问题.eslintrc,js

globals: {
  $ref: 'readonly',
  $computed: 'readonly',
  $shallowRef: 'readonly',
  $customRef: 'readonly',
  $toRef: 'readonly'
}
Run Code Online (Sandbox Code Playgroud)

...这对于global.d.ts

/// <reference types="vue/macros-global" />
Run Code Online (Sandbox Code Playgroud)