Skip to content

How to auto-import components in .tsx? files #836

Open
@atox996

Description

@atox996

Describe the bug

When using unplugin-vue-components to auto-import components, we noticed that the generated components.d.ts only declares global components for the vue module, for example:

declare module 'vue' {
  export interface GlobalComponents {
    TForm: typeof import('tdesign-vue-next')['Form'];
  }
}

This works well for .vue files, but in .tsx or .ts files using JSX, TypeScript still reports an error:

<TForm>...</TForm>
// ❌ Cannot find name 'TForm'. ts(2552)

This plugin works great in Vue projects — we hope it can become even better with improved TSX support in the future!

Reproduction

none

System Info

windows

Used Package Manager

pnpm

Validations

  • Follow our Code of Conduct
  • Read the Contributing Guide.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Check that this is a concrete bug. For Q&A, please open a GitHub Discussion instead.
  • The provided reproduction is a minimal reproducible of the bug.

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

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy