Skip to content

Options extends Record<string, never> #2240

Open
@skelouse

Description

@skelouse

Issue summary

Before opening this issue, I have:

  • Upgraded to the latest version of the relevant packages
    • @shopify/* package and version: @shopify/[email protected]
    • Node version: v20.17.0
    • Operating system: Ubuntu 24.04
  • Found a reliable way to reproduce the problem that indicates it's a problem with the package
  • Looked for similar issues in this repository
  • Checked that this isn't an issue with a Shopify API

Expected behavior

Client options should extend nothing for variables if there are no variables on the query

Actual behavior

Client options extend Record<string, never> when the query has no variables defined

Steps to reproduce the problem

// sample1
// query MetafieldDefinition($id: ID!) {
//   metafieldDefinition(id: $id) {
//     name
//   }
// }

// sample2
// query Shop {
//   shop {
//     name
//   }
// }

type Sample1 = typeof sample1;
type Sample2 = typeof sample2;

type Options1 = ApiClientRequestOptions<Sample1, AdminOperations>;
type Options2 = ApiClientRequestOptions<Sample2, AdminOperations>;

const opts1: Options1 = { apiVersion: '2024-10' };

// Error here: 
// Property 'apiVersion' is incompatible with index signature.
//      Type 'string' is not assignable to type 'never'
const opts2: Options2 = { apiVersion: '2024-10' };

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions