As TFile not working in dataviewjs

I am using dataview to build a table with a button for each row. The problem is that “as TFile” not working in dataviewjs. Can anyone help me with this?

const buttonMaker = (pv, fpath) => {
    const btn = this.container.createEl('button', {"text": "Done!"});
    const file = this.app.vault.getAbstractFileByPath(fpath) as TFile;
    btn.addEventListener('click', async (evt) => {
        evt.preventDefault();
        await this.app.vault.append(pv,file);
    });
    return btn;
}
let today = new Date().toISOString().slice(0, 10)
dv.table(["Name", "Status", "Project", "Date", "",""], dv.pages("#tasks")
    .sort(t => t["due-date"], 'desc')
    .where(t => t.status != "Completed")
    .map(t => [t.file.link, t.status, t.project, t["Date"], 
    buttonMaker(today, t.file.path)])
    )

the as Something (typecasting) is a TypeScript feature. Since dataviewjs only accepts JavaScript, you can simply remove the as TFile part and it should work.