chore: More typescript FIXME's removed

This commit is contained in:
Tom Moor
2022-01-06 21:25:42 -08:00
parent 8d05c752ea
commit c6cc04cad8
58 changed files with 199 additions and 221 deletions

View File

@@ -20,7 +20,6 @@ export default async function collectionIndexing(teamId: string) {
sortableCollections = naturalSort(
sortableCollections,
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type '(collection: any) => any' is not... Remove this comment to see the full error message
(collection) => collection[0].name
);

View File

@@ -8,8 +8,8 @@ export function getCookieDomain(domain: string) {
export function isCustomDomain(hostname: string) {
const parsed = parseDomain(hostname);
// @ts-expect-error ts-migrate(2345) FIXME: Argument of type 'string | undefined' is not assig... Remove this comment to see the full error message
const main = parseDomain(process.env.URL);
return (
parsed && main && (main.domain !== parsed.domain || main.tld !== parsed.tld)
);

View File

@@ -1,16 +1,14 @@
import { Node } from "prosemirror-model";
import { parser } from "rich-markdown-editor";
export default function parseDocumentIds(text: string): string[] {
const value = parser.parse(text);
// @ts-expect-error ts-migrate(7034) FIXME: Variable 'links' implicitly has type 'any[]' in so... Remove this comment to see the full error message
const links = [];
const links: string[] = [];
// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'node' implicitly has an 'any' type.
function findLinks(node) {
function findLinks(node: Node) {
// get text nodes
if (node.type.name === "text") {
// get marks for text nodes
// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'mark' implicitly has an 'any' type.
node.marks.forEach((mark) => {
// any of the marks links?
if (mark.type.name === "link") {
@@ -22,7 +20,6 @@ export default function parseDocumentIds(text: string): string[] {
const lastToken = tokens[tokens.length - 1];
// don't return the same link more than once
// @ts-expect-error ts-migrate(7005) FIXME: Variable 'links' implicitly has an 'any[]' type.
if (!links.includes(lastToken)) {
links.push(lastToken);
}
@@ -39,6 +36,5 @@ export default function parseDocumentIds(text: string): string[] {
}
findLinks(value);
// @ts-expect-error ts-migrate(7005) FIXME: Variable 'links' implicitly has an 'any[]' type.
return links;
}

View File

@@ -1,14 +1,12 @@
import { Node } from "prosemirror-model";
import { parser } from "rich-markdown-editor";
export default function parseImages(text: string): string[] {
const value = parser.parse(text);
// @ts-expect-error ts-migrate(7034) FIXME: Variable 'images' implicitly has type 'any[]' in s... Remove this comment to see the full error message
const images = [];
const images: string[] = [];
// @ts-expect-error ts-migrate(7006) FIXME: Parameter 'node' implicitly has an 'any' type.
function findImages(node) {
function findImages(node: Node) {
if (node.type.name === "image") {
// @ts-expect-error ts-migrate(7005) FIXME: Variable 'images' implicitly has an 'any[]' type.
if (!images.includes(node.attrs.src)) {
images.push(node.attrs.src);
}
@@ -24,6 +22,5 @@ export default function parseImages(text: string): string[] {
}
findImages(value);
// @ts-expect-error ts-migrate(7005) FIXME: Variable 'images' implicitly has an 'any[]' type.
return images;
}