chore: More typescript FIXME's removed
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user