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

Typescript EASDK - Page Breadcrumbs prop only accepts LinkAction[] #306

Closed
sdn90 opened this issue Apr 29, 2018 · 2 comments
Closed

Typescript EASDK - Page Breadcrumbs prop only accepts LinkAction[] #306

sdn90 opened this issue Apr 29, 2018 · 2 comments

Comments

@sdn90
Copy link

sdn90 commented Apr 29, 2018

Issue summary

I'm using 2.0.0.beta-18 but took a look at a few 1.x.x releases and the type hasn't changed.

Expected behavior

From what I've gathered reading #116 (comment) and other issues, 1.7.0 introduced handling for the following to be added to breadcrumbs:

interface {
  onAction: () => void,
  target: "app" | "new" | "shopify" | "parent" 
}

I'm assuming this is supposed to be referencing EASDKAction?

polaris/src/types.ts

Lines 47 to 52 in 5de1c3c

export interface EASDKAction
extends Action,
DisableableAction,
DestructableAction {
target?: EASDKTarget;
}

Actual behavior

Type '{ children: Element; title: string; breadcrumbs: { url: string; target: string; }[]; }' is not assignable to type 'IntrinsicAttributes & IntrinsicClassAttributes<Component<Props, ComponentState, never>> & Readonl...'.
  Type '{ children: Element; title: string; breadcrumbs: { url: string; target: string; }[]; }' is not assignable to type 'Readonly<Props>'.
    Types of property 'breadcrumbs' are incompatible.
      Type '{ url: string; target: string; }[]' is not assignable to type 'LinkAction[] | undefined'.
        Type '{ url: string; target: string; }[]' is not assignable to type 'LinkAction[]'.
          Type '{ url: string; target: string; }' is not assignable to type 'LinkAction'.
            Property 'target' does not exist on type 'LinkAction'.

Steps to reproduce the problem

<AppProvider apiKey={API_KEY} shopOrigin={SHOP_ORIGIN}>
  <Page
    title="Title"
    breadcrumbs={[{ url: "/products/123", target: "app" }]}
  />
</AppProvider>

Specifications

  • Polaris version: 2.0.0.beta-18
  • React version: 16.0.36
@AndrewMusgrave
Copy link
Member

Hi @sdn90, thanks for bringing this up. Target has be added to the breadcrumb prop on page!

@ry5n
Copy link
Contributor

ry5n commented Jun 7, 2018

With the latest release, this should now be available. Please let us know if you have any further issues with it.

@ry5n ry5n closed this as completed Jun 7, 2018
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

3 participants