createDocument method not working as expected

I am testing the following:

const { app, core, action } = require("photoshop");

await app.createDocument(
            {width: 2000},
            {height: 5000},
            {resolution: 300},
            {name: "test"},
            {profile: "sRGB IEC61966-2.1"},
            {mode: constants.NewDocumentMode.RGB}

What I get is nothing close to what I specified:
I get mew doc, with:
width 2000 - this is ok
height 1500 - should be 5000
color space is adobe RGB - should be sRGB
name is Untitled-2 - should be test.

What am I doing wrong?

I followed the API here
I could create a batchplay function for it but whenever I can use the API methods I’d rather use them.

Looks like the error was because the options were separated into multiple objects and they should be in a single object like this: {width: 2000, height:5000, …}

Try this code:

import { app, constants, core } from "photoshop";

export const createNewDocument = async () => {
  try {
    await core.executeAsModal(
      async () =>
        await app.createDocument({
          typename: "DocumentCreateOptions",
          width: 2000,
          height: 5000,
          resolution: 300,
          mode: constants.NewDocumentMode.RGB,
          profile: "sRGB IEC61966-2.1",
        commandName: "Creating new document...",
  } catch (e) {

To call this function you can just write like this: