Cannot find name 'PagesFunction'
Hello, Im quite new to all of this. I just set up a website on pages, that part works perfectly. I Want to add a contact form with mailchannels and used the code in the docs (https://developers.cloudflare.com/pages/platform/functions/plugins/mailchannels/) as a starting point. However i get the error that PagesFunction cannot be found. Do i need to do additional setup outside of what is mentioned in the docs? I can't seem to find many tutorials explaining this in depth.
I started a clean pure html project to test and it has the same error. I ran npm init and installed the the plugin without errors. I then created a file called _middleware.ts in a folder called functions in the root of the project. This is where i pasted the code from the docs, and where the error shows.
MailChannels · Cloudflare Pages docs
The MailChannels Pages Plugin intercepts all form submissions made which have the data-static-form-name attribute set. Then, it emails these form …
1 Reply
Try installing @Cloudflare/workers-types and then adding it to the compilerOptions.types array in your tsconfig