Skip to content

Compiler error on initial install #76

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

Closed
cburgmer opened this issue Dec 30, 2017 · 2 comments
Closed

Compiler error on initial install #76

cburgmer opened this issue Dec 30, 2017 · 2 comments

Comments

@cburgmer
Copy link

I might be doing it wrong, but following the steps layed out in http://www.angularplayground.it/docs/getting-started/angular-cli I yield the following when running npm run playground:

[ng serve]:
ERROR in /my_project/src/sandboxes.ts (14,14): Expression expected.
ERROR in /my_project/src/sandboxes.ts (14,20): Unreachable code detected.
ERROR in /my_project/src/sandboxes.ts (14,88): Property 'then' does not exist on type '"./app/my-widget/my-widget.component.sandbox"'.

The file in src/sandboxes.ts looks like

export function getSandboxMenuItems() {
  return [{
    'key': './app/my-widget/my-widget.component.sandbox',
    'searchKey': 'MyWidgetComponent',
    'name': 'MyWidgetComponent',
    'label': '',
    'scenarioMenuItems': [{'key': 1, 'description': 'with simple text'}]
  }];
}

export function getSandbox(path: string) {
  switch (path) {
    case './app/my-widget/my-widget.component.sandbox':
      return import('./app/my-widget/my-widget.component.sandbox').then(sandbox => { return sandbox.default.serialize('./app/my-widget/my-widget.component.sandbox'); });
  }
}

I did change the module to esnext in src/tsconfig.app.json.

Versions:

$ cat package-lock.json | grep @angular/cli
    "@angular/cli": {
      "resolved": "https://registry.npmjs.org//@angular/cli/-/cli-1.5.0.tgz",
$ cat package-lock.json | grep angular-playground
    "angular-playground": {
      "resolved": "https://registry.npmjs.org/angular-playground/-/angular-playground-3.0.0.tgz",
@mgmarlow
Copy link
Contributor

mgmarlow commented Jan 2, 2018

The error seems to suggest an issue with dynamic import support. Could you provide your Typescript version and the output of ng -v?

@mgmarlow
Copy link
Contributor

mgmarlow commented Jan 3, 2018

This problem should be solved w/ #75. Please create a new ticket if you're still having issues after updating.

@mgmarlow mgmarlow closed this as completed Jan 3, 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

2 participants