I'm struggling with this error. this error is occured at
error Parsing error: Unexpected token
7 |
8 | Vue.config.productionTip = false
> 9 | declare global{
| ^
10 | interface Window{
11 | getAlert : any;
12 | }
I found many answers exist and I followed but it's not working. Many answers are likely adding this senetence.
parser: 'babel-eslint'
but this option is already done when the project is created.
.eslintrc.js
module.exports = {
root: true,
env: {
node: true
},
'extends': [
'plugin:vue/essential',
'eslint:recommended'
],
parserOptions: {
parser: 'babel-eslint'
},
rules: {
'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off',
'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off'
}
}
main.ts
import Vue from 'vue'
import App from './App.vue'
import './registerServiceWorker'
import router from './router'
import store from './store'
import vuetify from './plugins/vuetify'
Vue.config.productionTip = false
declare global{
interface Window{
getAlert : any;
}
}
var vm = new Vue({
router,
store,
vuetify,
methods:{
getAlert(){
alert(11111)
}
},
render: h => h(App)
}).$mount('#app')
window.getAlert = vm.getAlert
How to solve this problem? I really want to make a window property.
common.d.ts(updated)
declare global{
interface Window{
getAlert : any;
}
}