fix: revert trashFile, add explicit type casts for any warnings

This commit is contained in:
Axelle Abbadie 2026-05-13 00:28:06 +02:00
parent 31a93b00f5
commit 6c103fe1dd
5 changed files with 6 additions and 6 deletions

View file

@ -1345,7 +1345,7 @@ var PseudObsPlugin = class extends import_obsidian7.Plugin {
const store = new MappingStore({ type: "file", path: mdPath });
await this.app.vault.create(mappingPath, JSON.stringify(store.toJSON(), null, 2));
}
await this.app.fileManager.trashFile(file);
await this.app.vault.delete(file);
const mdFile = this.app.vault.getAbstractFileByPath(mdPath);
if (mdFile instanceof import_obsidian7.TFile) {
await this.app.workspace.getLeaf().openFile(mdFile);

View file

@ -239,7 +239,7 @@ export default class PseudObsPlugin extends Plugin {
}
// Supprimer le fichier source non-Markdown maintenant remplacé par le .md
await this.app.fileManager.trashFile(file);
await this.app.vault.delete(file);
// Ouvrir le .md
const mdFile = this.app.vault.getAbstractFileByPath(mdPath);
@ -445,7 +445,7 @@ export default class PseudObsPlugin extends Plugin {
}
async loadSettings(): Promise<void> {
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData());
this.settings = Object.assign({}, DEFAULT_SETTINGS, await this.loadData()) as PseudObsSettings;
}
async saveSettings(): Promise<void> {

View file

@ -29,7 +29,7 @@ export class ScopeResolver {
try {
const raw = await this.vault.read(child);
const data: MappingFile = JSON.parse(raw);
const data = JSON.parse(raw) as MappingFile;
const store = MappingStore.fromJSON(data);
allRules.push(...store.getValidatedFor(filePath));
} catch {

View file

@ -164,7 +164,7 @@ export class QuickPseudonymizeModal extends Modal {
const mappingTFile = this.app.vault.getAbstractFileByPath(mappingPath);
if (mappingTFile instanceof TFile) {
const data: MappingFile = JSON.parse(await this.app.vault.read(mappingTFile));
const data = JSON.parse(await this.app.vault.read(mappingTFile)) as MappingFile;
store = MappingStore.fromJSON(data);
} else {
await this.plugin.ensureFolder(this.plugin.settings.mappingFolder);

View file

@ -145,7 +145,7 @@ export class RuleModal extends Modal {
const mappingFile = this.app.vault.getAbstractFileByPath(mappingPath);
if (mappingFile instanceof TFile) {
const data: MappingFile = JSON.parse(await this.app.vault.read(mappingFile));
const data = JSON.parse(await this.app.vault.read(mappingFile)) as MappingFile;
store = MappingStore.fromJSON(data);
} else {
await this.plugin.ensureFolder(this.plugin.settings.mappingFolder);