Skip to content

Commit

Permalink
Add html-entities
Browse files Browse the repository at this point in the history
  • Loading branch information
sirreal committed Mar 27, 2020
1 parent 2e7f996 commit adaacd1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/html-entities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"main": "build/index.js",
"module": "build-module/index.js",
"react-native": "src/index",
"types": "build-types",
"dependencies": {
"@babel/runtime": "^7.8.3"
},
Expand Down
4 changes: 3 additions & 1 deletion packages/html-entities/src/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/** @type {HTMLTextAreaElement} */
let _decodeTextArea;

/**
Expand Down Expand Up @@ -36,5 +37,6 @@ export function decodeEntities( html ) {
_decodeTextArea.innerHTML = html;
const decoded = _decodeTextArea.textContent;
_decodeTextArea.innerHTML = '';
return decoded;
// Cast to string, HTMLTextElement should always have `string` textContent
return /** @type {string} */ ( decoded );
}
8 changes: 8 additions & 0 deletions packages/html-entities/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"extends": "../../tsconfig.base.json",
"compilerOptions": {
"rootDir": "src",
"declarationDir": "build-types"
},
"include": [ "src/**/*" ]
}
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
{ "path": "packages/blob" },
{ "path": "packages/dom-ready" },
{ "path": "packages/escape-html" },
{ "path": "packages/html-entities" },
{ "path": "packages/i18n" },
{ "path": "packages/is-shallow-equal" },
{ "path": "packages/priority-queue" },
Expand Down

0 comments on commit adaacd1

Please sign in to comment.