1
0
mirror of https://github.com/matrix-org/matrix-react-sdk.git synced 2025-08-07 21:23:00 +03:00

Conform more of the codebase with strictNullChecks (#10703)

This commit is contained in:
Michael Telatynski
2023-04-25 09:28:48 +01:00
committed by GitHub
parent db40479910
commit 619a9e8542
24 changed files with 108 additions and 77 deletions

View File

@@ -16,7 +16,7 @@ limitations under the License.
*/
import * as linkifyjs from "linkifyjs";
import { Opts, registerCustomProtocol, registerPlugin } from "linkifyjs";
import { EventListeners, Opts, registerCustomProtocol, registerPlugin } from "linkifyjs";
import linkifyElement from "linkify-element";
import linkifyString from "linkify-string";
import { User } from "matrix-js-sdk/src/matrix";
@@ -136,7 +136,7 @@ export const ELEMENT_URL_PATTERN =
")(#.*)";
export const options: Opts = {
events: function (href: string, type: string): Partial<GlobalEventHandlers> {
events: function (href: string, type: string): EventListeners {
switch (type as Type) {
case Type.URL: {
// intercept local permalinks to users and show them like userids (in userinfo of current room)
@@ -185,9 +185,11 @@ export const options: Opts = {
},
};
}
return {};
},
formatHref: function (href: string, type: Type | string): string {
formatHref: function (href: string, type: Type | string): string | null {
switch (type) {
case Type.RoomAlias:
case Type.UserId:
@@ -205,7 +207,7 @@ export const options: Opts = {
className: "linkified",
target: function (href: string, type: Type | string): string {
target: function (href: string, type: Type | string): string | null {
if (type === Type.URL) {
try {
const transformed = tryTransformPermalinkToLocalHref(href);