Skip to content

Commit cd61c55

Browse files
authored
🤖 Merge PR DefinitelyTyped#71746 fix(html-escaper): fix FalseCJS by introduing export map for cjs & esm by @hkleungai
1 parent cc045ec commit cd61c55

File tree

6 files changed

+23
-5
lines changed

6 files changed

+23
-5
lines changed

‎attw.json‎

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,6 @@
157157
"has-package-exports",
158158
"hellosign-embedded",
159159
"hellosign-sdk",
160-
"html-escaper",
161160
"html-minifier-terser",
162161
"html-to-text",
163162
"i18next-fs-backend",
Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,14 @@
11
import { escape, unescape } from "html-escaper";
2+
import htmlEscaper = require("html-escaper");
23

34
// $ExpectType string
4-
const escaped = escape("<bella>");
5+
escape("<bella>");
56

67
// $ExpectType string
7-
const unescaped = unescape(escaped);
8+
unescape(escape("<bella>"));
9+
10+
// $ExpectType string
11+
htmlEscaper.escape("<bella>");
12+
13+
// $ExpectType string
14+
htmlEscaper.unescape(htmlEscaper.escape("<bella>"));
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
interface htmlEscaperStatic {
2+
escape(str: string): string;
3+
unescape(str: string): string;
4+
}
5+
6+
declare const htmlEscaper: htmlEscaperStatic;
7+
export = htmlEscaper;
Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1 @@
1-
export function escape(str: string): string;
2-
export function unescape(str: string): string;
1+
export { escape, unescape } from "./index.d.cjs";

‎types/html-escaper/package.json‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,11 @@
22
"private": true,
33
"name": "@types/html-escaper",
44
"version": "3.0.9999",
5+
"type": "module",
6+
"exports": {
7+
"import": "./index.d.ts",
8+
"default": "./index.d.cts"
9+
},
510
"projects": [
611
"https://github.com/WebReflection/html-escaper"
712
],

‎types/html-escaper/tsconfig.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
"forceConsistentCasingInFileNames": true
1414
},
1515
"files": [
16+
"index.d.cts",
1617
"index.d.ts",
1718
"html-escaper-tests.ts"
1819
]

0 commit comments

Comments
 (0)