Skip to content

Type of ComponentExposed does not seem to be properly detected #2956

@mitar

Description

@mitar

Checklist

  • I have tried restarting my IDE and the issue persists.
  • I have read the FAQ and my problem is not listed.

Tell us about your environment

  • ESLint version: 9.39.1
  • eslint-plugin-vue version: 10.5.0
  • Vue version: 3.5.22
  • Node version: 24.11.1
  • Operating System: Ubuntu 24.04

Please show your full configuration:

import { includeIgnoreFile } from "@eslint/compat";
import eslint from "@eslint/js";
import tseslint from "typescript-eslint";
import eslintPluginVue from 'eslint-plugin-vue';
import vueParser from 'vue-eslint-parser'
import globals from "globals";
import path from "node:path";
import { fileURLToPath } from "node:url";

const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
const gitignorePath = path.resolve(__dirname, ".gitignore");

export default tseslint.config(
  eslint.configs.recommended,
  ...tseslint.configs.recommendedTypeChecked,
  ...eslintPluginVue.configs['flat/recommended'],
  includeIgnoreFile(gitignorePath),
  {
    files: ["**/*.{js,vue,ts,html}"],
    rules: {
      "no-unused-vars": "off",
      "no-undef": "off",
      "@typescript-eslint/switch-exhaustiveness-check": "error",
      "@typescript-eslint/no-unused-vars": [
        "error",
        {
          args: "none",
          caughtErrors: "none",
        },
      ],
      "vue/multi-word-component-names": ["off"],
    },
    languageOptions: {
      ecmaVersion: "latest",
      sourceType: "module",
      globals: {
        ...globals.browser,
        ...globals.es2025,
      },
      parser: vueParser,
      parserOptions: {
        extraFileExtensions: [".vue", ".html"],
        parser: tseslint.parser,
        projectService: {
          allowDefaultProject: ["*.js", "*.html"],
        },
        tsconfigRootDir: __dirname,
      },
    },
  },
)

What did you do?

I am trying to enable eslint with type checking on Vue project (using tseslint.configs.recommendedTypeChecked and @typescript-eslint/switch-exhaustiveness-check.

What did you expect to happen?

eslint should find real typing issues.

What actually happened?

It finds typing issues which vue-tsc does not find and which by documentation should work. Namely, it detects the type of ComponentExposed as any.

Repository to reproduce this issue

https://github.com/mitar/vue-eslint-issue

Run npm run lint:

> [email protected] lint
> eslint . --fix --cache


/tmp/vue-project/src/components/TheWelcome.vue
  14:31  error  'any' overrides all other types in this union type  @typescript-eslint/no-redundant-type-constituents

/tmp/vue-project/src/main.ts
  6:11  error  Unsafe argument of type error typed assigned to a parameter of type `Component<any, any, any, ComputedOptions, MethodOptions, {}, any>`  @typescript-eslint/no-unsafe-argument

✖ 2 problems (2 errors, 0 warnings)

The problematic to me is the first error because it says that ComponentExposed<typeof EcosystemIcon> is inferred into any. Which is unexpected.

On the other hand, running npm run type-check does not produce any errors, even with strict set.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions