Vault.copy()
according to the docs
has the following signature.
copy(file: TFile, newPath: string): Promise<TFile>
However, based on its implementation and internal usage, it seems it also works for TFolder
.
For example, Make a copy
context menu action calls the same function for both files and folders.
I suggest the definition could be
copy(file: TFile, newPath: string): Promise<TFile>
copy(file: TFolder, newPath: string): Promise<TFolder>
copy(file: TAbstractFile, newPath: string): Promise<TAbstractFile>
// or
copy<T extends TAbstractFile>(file: T, newPath: string): Promise<T>