Skip to content

TS bug with Create Issue model #117

Closed
@JosephScript

Description

@JosephScript

There appears to be a bug with createIssue. I use the following code:

const issue = {
      fields: {
        summary: title,
        issuetype: {
          id: issuetype_id,
        },
        project: {
          id: project_id,
        },
        description: {
          type: 'doc',
          version: 1,
          content: [
            {
              type: 'paragraph',
              content: [
                {
                  text: description,
                  type: 'text',
                },
              ],
            },
          ],
        },
      },
    }

    client.issues.createIssue(issue)

Which is correct based on the API Documentation: https://developer.atlassian.com/cloud/jira/platform/rest/v3/api-group-issues/#api-rest-api-3-issue-post

However this error shows in typescript:

Types of property 'content' are incompatible.
          Type '{ type: string; content: { text: string; type: string; }[]; }[]' is not assignable to type '{ type: string; text: string; content?: any; }[]'.
            Property 'text' is missing in type '{ type: string; content: { text: string; type: string; }[]; }' but required in type '{ type: string; text: string; content?: any; }'.ts(2345)

If I conform to the error shown, the client returns an error: We can't create this issue for you right now, it could be due to unsupported content you've entered into one or more of the issue fields. If this situation persists, contact your administrator as they'll be able to access more specific information in the log file.. However, if I instead use client.issues.createIssue(issue as any) to get around the compiler error everything works as expected.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugIndicates a reported issue or malfunction that needs fixing.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions