Make return value of LinkifyIt.match nullable (#29810)

This commit is contained in:
Takuma Suzuki
2018-10-17 09:04:04 -07:00
committed by Sheetal Nandi
parent 9224cf6311
commit 0c9e5f3d40
2 changed files with 4 additions and 2 deletions
+1 -1
View File
@@ -45,7 +45,7 @@ declare namespace LinkifyIt {
interface LinkifyIt {
add(schema: string, rule: Rule): LinkifyIt;
match(text: string): Match[];
match(text: string): Match[] | null;
normalize(raw: string): string;
pretest(text: string): boolean;
set(options: Options): LinkifyIt;
+3 -1
View File
@@ -30,7 +30,9 @@ linkifier
const matches = linkifier.match(
"https://github.com/DefinitelyTyped/DefinitelyTyped/"
);
matches.forEach(({ index, lastIndex, raw, schema, text, url }) => {});
if (matches !== null) {
matches.forEach(({ index, lastIndex, raw, schema, text, url }) => {});
}
// complex rule
linkifier.add("@", {