I use Vue3(vite) SFC, and here is my snippet code:
<button :>1</button>
<button :>2</button>
and the typescript has wrong message:
Type '{ button__active: boolean; }' is not assignable to type 'string | boolean | undefined'。ts(2322)
I don't know how to handle this in , or can typescript skip check, thanks?
CodePudding user response:
Maybe a little change in the syntax will help?
<button :>1</button>
<button :>2</button>
CodePudding user response:
It should work, I tried in the code snippet and it is working without any warnings/errors.
new Vue({
el: '#app',
data: {
checked: '1'
}
})
.button__active {
background-color: green;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/typescript/4.8.0-beta/typescript.min.js"></script>
<div id="app">
<button :>1</button>
<button :>2</button>
</div>