Skip to content

Commit c3b1e88

Browse files
authored
🤖 Merge PR DefinitelyTyped#74095 React-highlight-words: update highlightClassName type to support Record<string, string> by @fzscodes
1 parent 596664a commit c3b1e88

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

‎types/react-highlight-words/index.d.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ export interface HighlighterProps {
3333
*/
3434
findChunks?: ((options: FindChunks) => Chunk[]) | undefined;
3535
/** CSS class name applied to highlighted text */
36-
highlightClassName?: string | undefined;
36+
highlightClassName?: string | Record<string, string> | undefined;
3737
/** Inline styles applied to highlighted text */
3838
highlightStyle?: React.CSSProperties | undefined;
3939
/**

‎types/react-highlight-words/react-highlight-words-tests.tsx‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,11 @@ class HighlighterTest extends React.Component {
6060
unhighlightStyle={{ color: "red" }}
6161
unhighlightTag={CustomUnhighlight}
6262
/>
63+
<Highlighter
64+
highlightClassName={{ el: "highlight-el", or: "highlight-or" }}
65+
searchWords={["el", "or"]}
66+
textToHighlight="Hello World"
67+
/>
6368
</div>
6469
);
6570
}

0 commit comments

Comments
 (0)