Skip to content

Commit 4e272c0

Browse files
authored
🤖 Merge PR DefinitelyTyped#73336 Add type definitions for cheerio-tableparser by @joshkel
1 parent bb34d83 commit 4e272c0

File tree

5 files changed

+63
-0
lines changed

5 files changed

+63
-0
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
*
2+
!**/*.d.ts
3+
!**/*.d.cts
4+
!**/*.d.mts
5+
!**/*.d.*.ts
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
import cheerio = require("cheerio");
2+
import cheerioTableParser = require("cheerio-tableparser");
3+
4+
const $ = cheerio.load("<table><tr><td>1</td></tr></table>");
5+
cheerioTableParser($);
6+
7+
const table1: string[][] = $("table").parsetable();
8+
const table2: string[][] = $("table").parsetable(true, true, true);
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import type { CheerioAPI } from "cheerio";
2+
3+
declare module "cheerio" {
4+
interface Cheerio<T> {
5+
parsetable(dupCols?: boolean, dupRows?: boolean, textMode?: boolean): string[][];
6+
}
7+
}
8+
9+
declare function tableParser($: CheerioAPI): void;
10+
11+
export = tableParser;
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"private": true,
3+
"name": "@types/cheerio-tableparser",
4+
"version": "1.0.9999",
5+
"projects": [
6+
"https://github.com/misterparser/cheerio-tableparser#readme"
7+
],
8+
"dependencies": {
9+
"cheerio": ">=1"
10+
},
11+
"devDependencies": {
12+
"@types/cheerio-tableparser": "workspace:."
13+
},
14+
"owners": [
15+
{
16+
"name": "Josh Kelley",
17+
"githubUsername": "joshkel"
18+
}
19+
]
20+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
{
2+
"compilerOptions": {
3+
"module": "node16",
4+
"lib": [
5+
"es6"
6+
],
7+
"noImplicitAny": true,
8+
"noImplicitThis": true,
9+
"strictFunctionTypes": true,
10+
"strictNullChecks": true,
11+
"types": [],
12+
"noEmit": true,
13+
"forceConsistentCasingInFileNames": true
14+
},
15+
"files": [
16+
"index.d.ts",
17+
"cheerio-tableparser-tests.ts"
18+
]
19+
}

0 commit comments

Comments
 (0)