Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Exported external package typings file is not a module #365

Closed
Gelio opened this issue Jun 26, 2016 · 2 comments
Closed

Exported external package typings file is not a module #365

Gelio opened this issue Jun 26, 2016 · 2 comments

Comments

@Gelio
Copy link

Gelio commented Jun 26, 2016

I've finally set up Meteor to use Angular2 and Typescript, but when importing zone.js both Visual Studio Code and Meteor's typescript compiler complain about zone.js.d.ts not being a module.

The application works fine and it's just a minor development error, but it persists every time a change is made to the project, which may be annoying when looking at logs.

The code that I've used:

import 'reflect-metadata';
import 'zone.js';
import { Component } from '@angular/core';
import { bootstrap } from '@angular/platform-browser-dynamic';

@Component({
  selector: 'app',
  templateUrl: '/client/app.html'
})
class Socially {
  constructor() {
    console.log("Hi from inside the constructor");
  }
}

bootstrap(Socially);

I have tried to install a zone.js typings file (with typings) but it did not work.

@agxs
Copy link

agxs commented Jul 8, 2016

I have the same problem. If I edit the zone.js.d.ts and change the top line from interface Zone to export interface Zone then the error disappears.

I'm not sure that's 100% the correct thing to do due to what's described in #93 but it'd good enough for my purposes.

@IgorMinar
Copy link
Contributor

you should not import zone.js from your application like this. If you do, you are loading the prolyfill too late which means that part of your environment (module loader) won't be under the oversight of zone.js - things might seem to work for a while but sooner or later you'll run into issues when updates to the ui stop happening and you won't know why.

For this reason it's better to always include all polyfills before any module loader (systemjs) or application code. This is why we recommend loading zones as the first script in index.html.

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

No branches or pull requests

3 participants