Bug report: When using fetch in an Action, the fetch response typing is wrong in the editor

Bug:
When using fetch to perform HTTP calls in the editor for an Action, the editor doesn’t recognize any of the properties that the fetch response has. If you try to use the properties response.ok, response.text(), response.json() that exist on the response, the editor will report it as an error. The error message will look like this: Property 'ok' does not exist on type 'Response'.(2339). The code works fine when you run it. The type is also correctly recognized in other code editors, such as VS Code and Rider.

image

Reproduction steps:
Create an Action from scratch. Give it a name and select “Login / Post login” as a trigger and Node 18 as a runtime. Then paste this code into the action:

exports.onExecutePostLogin = async (event, api) => {
  const response = await fetch('https://example.com');
  const ok = response.ok;
  const text = await response.text();
  console.log(ok, text);
};

You will now see that the editor reports an error but the code works fine if you run it.

+1: We are running into this issue as well. The fetch request and accessing the Response object’s properties and functions all function as expected, but it seems like the types are not resolving correctly.

exports.onExecutePostLogin = async (event, api) => {
  const response = await fetch('https://httpbin.org/get', {
    headers: {
      'Accept': 'application/json',
    },
  });
  console.log('status =', response.status);
  if (response.ok) {
    const responseJson = await response.json();
    console.log('json =', responseJson);
  }
}

Note: We do not see this issue locally when using the following tsconfig.json:

{
  "extends": "@tsconfig/node18/tsconfig.json",
  "compilerOptions": {
    "rootDir": "src",
    "outDir": "dist"
  }
}

( npm install @tsconfig/node18 )