I am just starting Angular 2 / Typescript using the 5 Minute Quickstart found here. I've run into what looks to be a common problem, but maybe a bit different. I am encountering all sorts of "No Exported Member" problems. Examples:
From app.module.ts:
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
Returns
...node_modules/@angular2/core/index" has no exported member 'NgModule'.
and
...@angular/platform-browser/index" has no exported member 'BrowserModule'.
And from main.ts:
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
throws:
...@angular/platform-browser-dynamic/index" has no exported member 'platformBrowserDynamic'.
I am running node version 4.4.7 and npm version 3.10.5.
I understand that these are probably resolvable in the context of the tutorial by rolling back node or npm to version relevant to the tutorial. I guess what I would prefer to have is an explanation of how to make the code from the tutorial relevant to the current versions of node.
ETA: These errors occur at compilation, not execution.
The module.js is used to export any literal, function or object as a module. It is used to include JavaScript file into node. js applications. The module is similar to variable that is used to represent the current module and exports is an object that is exposed as a module.
If you have a module x in which you are exporting some constructs using the module. exports object and you want to import these exported constructs in module y, you then need to require the module x in the module y using the require function.
TypeScript supports export = to model the traditional CommonJS and AMD workflow. The export = syntax specifies a single object that is exported from the module. This can be a class, interface, namespace, function, or enum.
The TypeScript declares module is one of the modules and keyword it is used for to surround and define the classes, interfaces; variables are also declared it will not originate with the TypeScript like that module is the set of files that contains values, classes, functions/methods, keywords, enum all these contains ...
For me it was VSCode editor issue. Simply reopening the editor resolved it
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With