Why is ESLint not flagging the implicit any
on this specific line:
// The variable `serializedResult` is of type `any`, which is permissible because the return value
// of `sendMessage(...)` is a `Promise<any>`. But why doesn't ESLint throw an error?
const serializedResult = await browser.runtime.sendMessage(serializedPacket);
Configuration files:
// Type declarations for functions are pulled from `index.d.ts`:
declare namespace browser.runtime
{
...
function sendMessage(message: any, options?: _SendMessageOptions): Promise<any>;
function sendMessage(extensionId: string, message: any, options?: _SendMessageOptions): Promise<any>;
...
}
// Configuration in .eslintrc.json
{
"env":
{
"browser": true,
"es2021": true
},
"extends":
[
"eslint:recommended",
"plugin:@typescript-eslint/recommended"
],
"parser": "@typescript-eslint/parser",
"parserOptions":
{
"ecmaVersion": "latest",
"sourceType": "module"
},
"ignorePatterns":
[
"bin/**"
],
"plugins":
[
"@typescript-eslint"
],
"rules":
{
"prefer-rest-params": "off",
"@typescript-eslint/no-explicit-any": "error"
}
}
// Content of tsconfig.json:
{
"compilerOptions":
{
"target": "es2022",
"module": "NodeNext",
"moduleResolution": "NodeNext",
"strict": true,
"noImplicitAny": true,
"esModuleInterop": true,
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"sourceMap": true
}
}
Could I be overlooking something? Is this setup correct?