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

TSIndexedAccessType unexpected error #19

Open
aynik opened this issue Mar 4, 2021 · 2 comments
Open

TSIndexedAccessType unexpected error #19

aynik opened this issue Mar 4, 2021 · 2 comments

Comments

@aynik
Copy link

aynik commented Mar 4, 2021

I have an autogenerated type (by graphql codegen) like this:

/** Specifies the fields required to create a new customer. */
export type CustomerCreateInput = {
  /** The customer’s first name. */
  readonly firstName?: Maybe<Scalars['String']>
  /** The customer’s last name. */
  readonly lastName?: Maybe<Scalars['String']>
  /** The customer’s email. */
  readonly email: Scalars['String']
  /**
   * A unique phone number for the customer.
   *
   * Formatted using E.164 standard. For example, _+16135551111_.
   */
  readonly phone?: Maybe<Scalars['String']>
  /** The login password used by the customer. */
  readonly password: Scalars['String']
  /** Indicates whether the customer has consented to be sent marketing material via email. */
  readonly acceptsMarketing?: Maybe<Scalars['Boolean']>
}

Then in the same file I add:

registerType('CustomerCreateInput')
export const isValidCustomerCreateInput = createValidator<CustomerCreateInput>()

And my app throws an error like this:

./models/shopify.ts
MacroError: <rootDir>/models/shopify.ts: Unexpected error because TSIndexedAccessType was not expected. Please report this to the developer.

Let me know if you need more information, and thanks for this library!

@vedantroy
Copy link
Owner

What is Scalars? Is it a type in the same file? Can you post the Scalars type?

@aynik
Copy link
Author

aynik commented Mar 7, 2021

What is Scalars? Is it a type in the same file? Can you post the Scalars type?

Sure, here it is:

export type Scalars = {
  ID: string;
  String: string;
  Boolean: boolean;
  Int: number;
  Float: number;
  /** An ISO-8601 encoded UTC date time string. Example value: `"2019-07-03T20:47:55Z"`. */
  DateTime: any;
  /** A signed decimal number, which supports arbitrary precision and is serialized as a string. Example value: `"29.99"`. */
  Decimal: any;
  /** A string containing HTML code. Example value: `"<p>Grey cotton knit sweater.</p>"`. */
  HTML: any;
  /** A monetary value string. Example value: `"100.57"`. */
  Money: any;
  /**
   * An RFC 3986 and RFC 3987 compliant URI string.
   *
   * Example value: `"https://johns-apparel.myshopify.com"`.
   *
   */
  URL: any;
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants