Plugin development: executeCommandById?

I see a few posts referencing executeCommandById but it doesn’t seem to be part of the current API?

ie. this.app.commands.executeCommandById('...') gives me main.ts(7,12): error TS2339: Property 'commands' does not exist on type 'App'.

What is the proper way of calling a command within a plugin? Anyone knows?

Thanks!

I figured out that if I do:

declare module 'obsidian' {
  interface App {
	commands: {
		commands: { [commandId: string]: { id: string, name: string, callback: () => void } }
		executeCommandById(commandId: string): boolean
	}
  }
}

then I can use:

this.app.commands.executeCommandById('...')

Or even sketchier:

const app = this.app as any
app.commands.executeCommandById('...')