Initializing new BorshCoder instance throws error (JS)

I am trying to decode a Solana transaction using anchor’s BorshCoder. I have a seperate file with the IDL of which the content was copied 1 on 1 from here: https://github.com/raydium-io/raydium-idl/blob/master/raydium_amm/idl.json

When creating a new BorshCoder class like this:

const { BorshCoder } = require('@coral-xyz/anchor');
const IDL = require("./idl.json");

const borshCoder = new BorshCoder(IDL);

This error is thrown

throw new error_js_1.IdlError(`Type not found: ${field.name}`);
IdlError: Type not found: undefined

Is the IDL file incorrect? All IDL files I have tried so far didn’t work one way or the other. So if this is the case could you provide me with a IDL json file that should work?