Error in VueJS: A linting issue is occurring with the message "JSX element type 'X' does not have any construct or call signatures" when attempting to globally register components

Everything seems to be in working order. I have successfully utilized the components and managed to build the app without encountering any issues. However, my text editor (VS Code) continues to throw a linting error even after attempting to register my own components. The problem persists both in this Electron-based project and when trying to create one using the actual CLI. It's worth mentioning that all installations were done today on a fresh machine.

Vue: v3.2.36 Vite: v2.9.9 Node: v18.3.0 NPM: v8.11.0

Even changing the name of my init file from client.ts to main.ts does not resolve the issue.

import { createApp } from "vue";
import App from "./App.vue";
import { Icon } from "@vicons/utils";
import {
    NButton,
    NCard,
    NTabs,
    NTabPane,
    NInput,
    NInputNumber,
    NSelect,
    NDataTable,
    NButtonGroup,
    NScrollbar,
    NModal,
} from "naive-ui";

const app = createApp(App);

app.component("Icon", Icon)
    .component("Button", NButton)
    .component("Card", NCard)
    .component("Tabs", NTabs)
    .component("TabPane", NTabPane)
    .component("Input", NInput)
    .component("InputNumber", NInputNumber)
    .component("Select", NSelect)
    .component("DataTable", NDataTable)
    .component("ButtonGroup", NButtonGroup)
    .component("Scrollbar", NScrollbar)
    .component("Modal", NModal)
    .mount("#app");

tsconfig.json

{
    "compilerOptions": {
        "target": "esnext",
        "useDefineForClassFields": true,
        "module": "esnext",
        "moduleResolution": "node",
        "strict": true,
        "jsx": "preserve",
        "sourceMap": true,
        "resolveJsonModule": true,
        "esModuleInterop": true,
        "lib": ["esnext", "dom"],
        "paths": {
            "@components": ["./components"],
            "@domain": ["./domain"],
            "@helpers": ["./helpers"],
            "@views": ["./views"]
        }
    },
    "include": ["./**/*.ts", "./**/*.d.ts", "./**/*.tsx", "./**/*.vue"]
}

An example of the linting error can be seen in this image: https://i.sstatic.net/e5n5w.png

Additionally, a warning message has been appearing in my terminal. Here is an image for reference:

https://i.sstatic.net/NavJ6.png

Answer №1

Error in Vue3 + TypeScript: Global components throwing "JSX element type '___' does not have any construct or call signatures.ts(2604)"

The problem I encountered was related to the latest update of the Volar extension. Reverting back to version 0.36.1 resolved the issue successfully.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Postman successfully interacts with cookies, while VueJS encounters difficulties in doing so

Currently, I have a Flask server up and running on , along with a Vue.js frontend running on http://localhost:8080. The API has been set up and tested using Postman, with everything functioning seamlessly as expected. Upon sending a POST request to /log ...

What is the process for importing components from a Stencil library into a React application?

After successfully creating: a stencilJS component library named "my-lib" using the "npm init stencil" wizard and an Ionic React app using "ionic start myApp tabs" I am now trying to incorporate the default "my-component," aka MyComponent from my-lib. H ...

Despite the session being expired, the Laravel API call still goes through successfully

My application is built as a Single Page Application using Laravel 5.8 and Vue 2.0. Currently, everything seems to be functioning smoothly, perhaps a bit too well. I noticed that even after deleting the session, I am able to perform actions such as saving ...

How to use the v-model to round up a number in Vue.js

I need to round up a number in my input field: <b-form-input id="amount_input" type="number" v-model="Math.ceil(form.contract.reward_cents / 100)" :state="validate(form.contract.reward_cents)"/> ...

What is the best way to retrieve the URL query parameters in a Node.js environment?

How can I retrieve URL query parameters in Node.js using TypeScript? Below is my attempted code: /** * My Server app */ import * as Http from "http"; import * as url from "url"; import { HttpServer } from "./HttpServer"; import { TaxCalculator } from ". ...

Encountered an error when incorporating nguniversal/express-engine into an Angular project: "Unable to locate the BrowserModule import in /src/app/app.module.ts"

One of the initial questions Purpose The main aim is to integrate SSR into my Angular project using ng add @nguniversal/express-engine --clientProject [name] (to enable dynamic prerendering of meta tags). Expected Outcome I anticipated the command to run ...

The ngIf statement in the template isn't functioning properly after a refresh; instead, it is causing a redirection to the homepage

I've been developing with Angular 7, trying to display a <div> ... </div> based on multiple values that I declared as : Boolean = false; in the .ts file. These values are updated in ngOnInit, but for some reason, the page keeps redirecting ...

Reduce the size of log messages in cypress

I am looking to shorten the cypress messages to a more concise string, for instance: Cypress log Transform to: -assert expected #buy-price-field to have value 17,169.00. Is there a way to achieve this? I have searched through the documentation but hav ...

What is the best way to leverage the Nextjs Link tag while also incorporating the data-dismiss attribute?

Currently, I am working on a Next.js project. In the mobile view, my navigation menu utilizes a modal to toggle the navbar. However, I have encountered an issue where when I click on a navigation link, the data gets dismissed but the link itself does not n ...

Mastering the Art of Disabling buttons in Vue Based on Conditions

In my current project, I'm attempting to compare specific values of an initial object with an updated object in order to disable a button if they are the same. However, despite making changes, the button remains disabled: setDisabled() { return th ...

Error: File or directory not found, unable to locate BUILD_ID

What is the next step? Error: ENOENT: The file or directory 'C:\Janani\ticket-app.next\BUILD_ID' does not exist { errno: -4058, code: 'ENOENT', syscall: 'open', path: 'C:\Janani\ticket-app\. ...

Exploring how to iterate through an object to locate a specific value with TypeScript and React

I am looking to hide a button if there is at least one order with status 'ACCEPTED' or 'DONE' in any area or subareas. How can I achieve hiding the "Hide me" menu item when there is at least one area with orders having status 'ACCE ...

Generic Abstract Classes in TypeScript

In my TypeScript code, I have an abstract generic class with a method that takes a parameter of a class type variable. When I tried to implement the abstract method in a derived class, I noticed that the TypeScript compiler doesn't check the type of t ...

Ways to showcase information retrieved from an API onto an Angular Material card

The process involves calling two different APIs. The first API gathers user information such as name, ID, and the IDs of applications where the user is registered. The second API retrieves details from each application based on its ID. Despite successfully ...

Set up an array data by extracting values from an array prop within a Vue component

Within my Vue component, I am dealing with an array prop called selectedSuppliers that consists of objects. My goal is to set up a data property named suppliers and initialize it with the values from selectedSuppliers. However, I do not want any modificati ...

Using vue-resource to intercept an ajax error and catching the "Uncaught (in promise)" exception

I am utilizing vue-resource to retrieve data from the server. In order to access the correct data, a user must possess a JWT token. If the token is invalid or has expired, a status code of 401 will be returned. Similarly, if a user attempts to reach a forb ...

VS Code couldn't locate a definition for the function 'myMethod'

For some reason, I am unable to find a definition for 'myMethod' in VS Code. In my angular projects, after importing one project into VS Code, I can easily navigate to definitions using the 'F12' key. However, when I import another pro ...

Having trouble containerizing a Vite React-Typescript project with Docker

I'm currently in the process of dockerizing a Vite React-Typescript boilerplate setup, but I'm encountering difficulties connecting to the container. Here's how I installed the vite-react-typescript boilerplate: npm init vite@latest vite-d ...

Modify the code in JavaScript without utilizing the keyword "let"

Looking for alternative approaches to avoid using let in this code snippet due to the risks associated with variable reassignment leading to bugs that are hard to debug. Any suggestions? function findNodeById<F extends ISomeOptions>( optionsList ...

Using VueJS and MomentJS to calculate the passage of time

I am currently working on a website that showcases concert information. One feature I'd like to add is a progress bar for each concert event. I'm trying to figure out how to incorporate MomentJS functions into this project. This is what my ini ...