Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript: Eslint can't detect types exported from Vue SFC #2375

Open
2 tasks done
jordan-erisman opened this issue Jan 23, 2024 · 0 comments
Open
2 tasks done

Typescript: Eslint can't detect types exported from Vue SFC #2375

jordan-erisman opened this issue Jan 23, 2024 · 0 comments

Comments

@jordan-erisman
Copy link

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: 8.56.0
  • **eslint-plugin-vue version:9.20.1
  • **Vue version:3.4.13
  • **Node version:18.18
  • **Operating System:OSX

Please show your full configuration:

module.exports = {
  ignorePatterns: ['tsconfig.json', '*.config.js', '*.config.ts'],
  extends: [
    'eslint:recommended',
    'plugin:vue/vue3-recommended',
    'plugin:@typescript-eslint/recommended',
    'plugin:@typescript-eslint/recommended-requiring-type-checking',
  ],
  plugins: ['@typescript-eslint'],
  parser: 'vue-eslint-parser',
  parserOptions: {
    parser: '@typescript-eslint/parser',
    project: ['tsconfig.json'],
    extraFileExtensions: ['.vue'],
  },
};

What did you do?

Reproduction link (StackBlitz). Run npm run lint

Child

<script lang="ts">
export type MyType = {
  test: string;
};
</script>

....

Parent

<script setup lang="ts">
import {type MyType} from './Child.vue';

// Unsafe assignment of an `any` value
const obj: MyType = { test: '123' };

// Unsafe member access .test on an `any` value
const test = obj.test;
</script>

What did you expect to happen?
The imported types to work. Typescript recognizes the type and does not complain, but eslint throws and error.

What actually happened?

  14:7   error  Unsafe assignment of an `any` value           @typescript-eslint/no-unsafe-assignment
  14:16  error  Unsafe member access .test on an `any` value  @typescript-eslint/no-unsafe-member-access

✖ 2 problems (2 errors, 0 warnings)

Repository to reproduce this issue

Reproduction link (StackBlitz). Run npm run lint

@jordan-erisman jordan-erisman changed the title Typescript: Eslint can't detect types exported from from Typescript: Eslint can't detect types exported from Vue SFC Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants