Conform more of the codebase with strictNullChecks
(#10703)
This commit is contained in:
parent
db40479910
commit
619a9e8542
24 changed files with 108 additions and 77 deletions
|
@ -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);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue