No More Posting New Topics!

If you have a question or an issue, please start a thread in our Github Discussions Forum.
This forum is closed for new threads/ topics.

Navigation

    Quasar Framework

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search

    Quasar project with TypeScript show error when importing 3rd party libraries

    Help
    1
    1
    228
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • T
      tempted2use last edited by

      I have created a Quasar CLI project using TypeScript. It’s all very impressing, but now I’m facing a problem importing 3rd party libraries (cheerio, jQuery or similar).

      I have a Index.vue file, where I’m fetching HTML/XML from an API. I need to find different nodes in the HTML/XML based on classes etc., hence I thought of using jQuery or cheerio to CSS select the node(s) I need.

      When importing cheerio:

      import {cheerio} from 'cheerio';
      

      I get the error:

      Could not find a declaration file for module 'cheerio'. 
      '/node_modules/cheerio/index.js' implicitly has an 'any' type.
        Try `npm install @types/cheerio` if it exists 
      or add a new declaration (.d.ts) file 
      containing `declare module 'cheerio';`Vetur(7016)
      

      Installing cheerio types does not work:

      npm install @types/cheerio
      

      If I look into node_modules/@types, there is a cheerio/index.d.ts file

      Any idea why this does not work out of the box with Quasar?

      1 Reply Last reply Reply Quote 0
      • First post
        Last post