I'm currently working with a stack that includes Vue3, Vite, and TypeScript. I've encountered an issue related to DOMTokenList where I'm trying to utilize the .entries()
method but TypeScript throws an error saying
Property 'entries' does not exist on type 'DOMTokenList'
Below is a snippet from my tsconfig file:
{
"extends": "@vue/tsconfig/tsconfig.web.json",
"include": ["env.d.ts", "src/**/*", "src/**/*.vue", "main.d.ts"],
"compilerOptions": {
"baseUrl": ".",
"paths": {
"@/*": ["./src/*"]
},
"typeRoots": ["./node_modules/@types", "src/core/types"],
"ignoreDeprecations": "5.0",
"lib":["DOM","ESNext"]
},
"references": [
{
"path": "./tsconfig.node.json"
}
]
}
In addition, I am attempting to use the .enties()
function for extending DOMTokenList like so:
DOMTokenList.prototype.removeStartWith = function(prefix:string){
this.remove(...Array.from(this.entries()).map(([,c]) => c).filter(c => c.startsWith(prefix)))
}
I have already tried utilizing previous ECMAScript versions (ES2019) without success. If you have any suggestions on how to resolve this issue, I would greatly appreciate it. Thank you!