My simple type is defined as shown below,
export type ClickEventProps = {
handler: (event: MouseEvent) => void;
additionalEvents?: Array<keyof DocumentEventMap>;
};
I'm facing an issue with ESLint, where it's flagging 'DocumentEventMap' as undefined and throwing a 'no-undef' error. Is there a way to resolve this without turning off the rule for this line? Could this possibly be a bug in '@typescript-eslint'?
The current development dependencies and versions I have for '@typescript-eslint' are,
"@typescript-eslint/eslint-plugin": "^5.59.7",
"@typescript-eslint/parser": "^5.59.7",
In .eslintrc.js, my configuration looks like this,
module.exports = {
env: {
browser: true,
es2021: true,
},
parser: '@typescript-eslint/parser',
parserOptions: {
ecmaFeatures: {
jsx: true,
},
ecmaVersion: 'latest',
sourceType: 'module',
},
plugins: ['prettier', 'react', '@typescript-eslint'],
};
And here is my tsconfig setup:
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext", "WebWorker"],
"skipLibCheck": true,
"esModuleInterop": true,
"allowSyntheticDefaultImports": true,
"strict": true,
"module": "esnext",
"jsx": "react-jsx",
"types": ["cypress", "node", "cypress-real-events"],
},
}