I created a brand-new Angular 6 project and installed Cheerio.js:
npm install cheerio
Once Cheerio.js was installed, I figured all I had to do to add it to my project was to import it and add it to the NgModule imports:
import { BrowserModule } from '@angular/platform-browser';
import { NgModule } from '@angular/core';
import { AppComponent } from './app.component';
import * as cheerio from 'cheerio';
@NgModule({
declarations: [
AppComponent
],
imports: [
BrowserModule,
cheerio
],
providers: [],
bootstrap: [AppComponent]
})
export class AppModule { }
However, after doing this, I'm getting a TypeScript error, something along the line of "Could not find a declaration file for module 'cheerio'."
Am I going about this the wrong way? I just need to be able to parse some HTML within the Angular app and read that Cheerio.js was the way to go.