Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TS bug with Create Issue model #117

Closed
JosephScript opened this issue Apr 28, 2021 · 1 comment · Fixed by #116
Closed

TS bug with Create Issue model #117

JosephScript opened this issue Apr 28, 2021 · 1 comment · Fixed by #116
Labels
bug Indicates a reported issue or malfunction that needs fixing.

Comments

@JosephScript
Copy link

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.

@MrRefactoring MrRefactoring added the bug Indicates a reported issue or malfunction that needs fixing. label Apr 28, 2021
@MrRefactoring MrRefactoring linked a pull request Apr 28, 2021 that will close this issue
@MrRefactoring
Copy link
Owner

Thanks for pointing out the error. Your comments are very important to me. Fixed it in version 2.1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates a reported issue or malfunction that needs fixing.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants