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 Cannot find module @shopify/polaris/embedded #20

Closed
buggy opened this issue Apr 24, 2017 · 1 comment
Closed

TypeScript Cannot find module @shopify/polaris/embedded #20

buggy opened this issue Apr 24, 2017 · 1 comment

Comments

@buggy
Copy link

buggy commented Apr 24, 2017

Issue summary

The TypeScript compiler is unable to find the type definition for @shopify/polaris/embedded at the following line:

import {EmbeddedApp} from "@shopify/polaris/embedded";

Expected behavior

I expect it to be able to find the type definition for @shopify/polaris/embedded and import the EmbeddedApp component .

Actual behavior

When running tsc I receive the following error:

src/containers/HomeContainer.tsx(3,27): error TS2307: Cannot find module '@shopify/polaris/embedded'.

Steps to Reproduce the Problem

I took the embedded app example from https://github.com/Shopify/polaris/blob/master/documentation/Embeddded%20apps.md and modified it to work with TypeScript. The new code is:

import * as React from "react";
import {Page, Card} from "@shopify/polaris";
import {EmbeddedApp} from "@shopify/polaris/embedded";

export default class MyApp extends React.Component<undefined, undefined> {
  render() {
    return (
      <EmbeddedApp
        apiKey="YOUR_APP_API_KEY"
        shopOrigin="https://CURRENT_LOGGED_IN_SHOP.myshopify.com"
      >
        <Page title="Example application">
          <Card sectioned>
            Insert the rest of your app here, including those components detailed below, which can now communicate with the Embedded App SDK.
          </Card>
        </Page>
      </EmbeddedApp>
    );
  }
}

The TypeScript compiler reports that it cannot find @shopify/polaris/embedded/

If I append export * from './embedded'; at the bottom of polaris/types/index.d.ts then import {EmbeddedApp} from "@shopify/polaris"; it finds the type definition so the file clearly exists and is valid. I'm not sure why TypeScript can't find it.

Specifications

  • Polaris version: 1.0.1
  • React version: 15.5.4
  • Browser: Firefox 53.0
  • Device: Mac
  • Operating System: 10.12.4
  • TypeScript 2.2.2

NOTE: This repo is only used for reporting issues and new feature requests. We are not accepting pull requests at this point in time.

@lemonmade
Copy link
Member

Thanks for the issue @buggy. I've merged a fix with this on our internal repo for Polaris and you should see the fixes in sometime today under version 1.0.2.

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