Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid cast to any #57

Merged
merged 2 commits into from
Jan 19, 2024
Merged

Avoid cast to any #57

merged 2 commits into from
Jan 19, 2024

Conversation

muness
Copy link
Member

@muness muness commented Jan 19, 2024

Per the automated scan we should avoid casting to any

@muness muness requested a review from durch January 19, 2024 17:13
@muness
Copy link
Member Author

muness commented Jan 19, 2024

Considered using the same implementation as https://github.com/dy-sh/obsidian-consistent-attachments-and-links/blob/master/src/links-handler.ts#L637-L663 for the fallback.

async getNotesThatHaveLinkToFile(filePath: string): Promise<string[]> {
		let notes: string[] = [];
		let allNotes = this.app.vault.getMarkdownFiles();

		if (allNotes) {
			for (let note of allNotes) {
				if (this.isPathIgnored(note.path))
					continue;

				let notePath = note.path;
				if (notePath == filePath)
					continue;

				let links = await this.getLinksFromNote(notePath);
				for (let link of links) {
					let li = this.splitLinkToPathAndSection(link.link);
					let linkFullPath = this.getFullPathForLink(li.link, notePath);
					if (linkFullPath == filePath) {
						if (!notes.contains(notePath))
							notes.push(notePath);
					}
				}
			}
		}

		return notes;
	}

but had trouble figuring out a signature that supported both.

@muness
Copy link
Member Author

muness commented Jan 19, 2024

@durch durch merged commit 7db8aa1 into master Jan 19, 2024
2 checks passed
@durch durch deleted the avoid-cast-to-any branch January 19, 2024 17:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants