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 = as TFile;
    btn.addEventListener('click', async (evt) => {
    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.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.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.