How can I use InputRules with custom transformations?

I am trying to use prosemirror-inputrules to automatically apply my custom transformations. But I am stuck at a stubborn tr.setMeta is not a function error. I looked through the console.error stack trace and tried reading the prosemirror-inputrules source code, but I could not understand where is the error coming from. Any help? Below is my code to reproduce the error:

import * as React from "react";

import {EditorState, Plugin} from "prosemirror-state";
import {EditorView} from "prosemirror-view";
import {Schema, DOMParser} from "prosemirror-model";

import {keymap} from "prosemirror-keymap";
import {baseKeymap} from "prosemirror-commands";
import {inputRules, InputRule} from "prosemirror-inputrules";

export default Editor = () => {
	React.useEffect(() => {
		const mySchema = new Schema({
			nodes: {
				text: {}, 
				paragraph: {
					content: "text*", 
					toDOM() {return ["p", 0]}, 
					parseDOM: [{tag: "p"}]
				doc: {
					content: "paragraph+"
		window.view = new EditorView(document.querySelector("#editor"), {
			state: EditorState.create({
				doc: DOMParser.fromSchema(mySchema).parse(document.querySelector("#content")), 
				plugins: [(schema => inputRules({
					rules: [new InputRule(
						(state, match, start, end) => {
							return (transformationState, dispatch) => {
								// Transformation... 
				}))(mySchema), keymap(baseKeymap), new Plugin({props: {}})]
	return (
			<div id="editor"/>
			<div id="content"/>

You replaced the code that’s probably the important part with with // Transformation..., but I suspect you’re dispatching something that’s not a transaction. Follow the stack trace, see what the uppermost function that you wrote is, and figure out what it’s doing wrong.