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] Some issues with generic types #177

Open
orblazer opened this issue Apr 13, 2022 · 0 comments
Open

[typescript] Some issues with generic types #177

orblazer opened this issue Apr 13, 2022 · 0 comments

Comments

@orblazer
Copy link

orblazer commented Apr 13, 2022

Hello,
I have make complex component (an component like react-select) but i have some issues with this component and type cheking.

Component Errors

Source code: https://gist.github.com/orblazer/d5d307444a2607c64744bbf56ebbc35b#file-select-svelte-L1

NOTE: This next line has commented type because in that case (all in one file) is bugged. https://gist.github.com/orblazer/d5d307444a2607c64744bbf56ebbc35b#file-select-svelte-L38

  • @typescript-eslint/no-unsafe-assignment : lines 60, 98, 105, 106
  • @typescript-eslint/no-unsafe-call : line 98
  • @typescript-eslint/no-unsafe-argument : line 98 (on index)
  • @typescript-eslint/no-unsafe-argument : lines 129 (on item.index) and 141 (on item.index and groupItem.index)

All errors say the value is any but VSCodes say me the right type of value.

Eslint config

module.exports = {
  root: true,
  parser: '@typescript-eslint/parser',
  extends: [
    'eslint:recommended',
    'plugin:@typescript-eslint/recommended',
    'plugin:@typescript-eslint/recommended-requiring-type-checking',
    'standard',
    'prettier'
  ],
  plugins: ['svelte3', '@typescript-eslint'],
  env: {
    es2021: true,
    browser: true
  },
  parserOptions: {
    ecmaVersion: 2021,
    sourceType: 'module',
    project: ['./tsconfig.eslint.json', './tsconfig.json'],
    extraFileExtensions: ['.svelte']
  },
  settings: {
    'svelte3/typescript': () => require('typescript') // pass the TypeScript package to the Svelte plugin
  },
  globals: {
    svelte: true //  For `svelte.JSX` type
  },
  overrides: [
    {
      files: ['*.svelte'],
      processor: 'svelte3/svelte3',
      rules: {
        'import/first': 'off',
        'import/no-duplicates': 'off',
        'import/no-mutable-exports': 'off',
        'import/prefer-default-export': 'off'
      }
    }
  ]
}

Thanks

@orblazer orblazer changed the title Some issues with generic types [typescript] Some issues with generic types Apr 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant