Variable is undeclared but can be used
Version
3.2.27
Reproduction link
Steps to reproduce
- setup function console.log visiable
- let { visiable } = useEffectFn()
What is expected?
Variable undeclared should throw error directly
What is actually happening?
Variable undeclared should throw error directly
变量未声明可以直接使用 应该抛出错误
setup() {
let state = reactive({
visible: false,
});
console.log(visibleVar); // 此处应该抛出错误 而不是undefined should throw error but get undefined
let { visibleVar } = useEffectFn();
const toggle = () => {
state.visible = !state.visible;
};
return {
...toRefs(state),
toggle,
};
},
You can copy the same code into main.js and it behaves the same.
So this is not related to Vue but to the build system you are using, likely.