Zolcsak Tamas Zolcsak Tamas - 1 year ago 91
TypeScript Question

Angular 2 final release: Cannot find name 'PatternDetails'

I'm getting an error that 'PatternList' (which is an interface created by me) is not found. If I try to import it I get an error that PatternDetails is not a module. I'm not sure what causes this error. I faced this error while I'm trying to configure Webpack in my angular2 project.

Here is one of my components that uses PatternDetails interface:

selector: 'pattern-detail',
template: `
<div class="pattern-detail" [ngClass]='{active: metadata.status.backendValidationStatus == "FAIL",
unactive: metadata.status.backendValidationStatus == "OK",
warning: metadata.status.backendValidationStatus == "WARN",
selected: metadata.selected
}' (click)="patternClicked(metadata)">
<div class="name-details">
<div class="time-details">
<p class='last_update'>{{metadata.lastupdate}}</p>
styleUrls: ['/css/pattern_detail.css']
export class PatternDetailComponent {

@Input() metadata:PatternDetails;
@Output() selectPattern = new EventEmitter<PatternDetails>();

patternClicked(pattern: PatternDetails) {


Here is the PatternDetails interface:

interface PatternDetails {
patternClass: string;
version: string;
id: string;
displayName: string;
lastupdate: string;
details: string;
status: Status;
selected: boolean;

I'm not sure what else I should include, but after my investigation I found that there might be an issue with tsconfig.json, so I include it as well:

"compilerOptions": {
"target": "es5",
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"removeComments": false,
"noImplicitAny": true,
"suppressImplicitAnyIndexErrors": true,
"typeRoots": [
"types" : [
"exclude": [


imports: [ BrowserModule, FormsModule, HttpModule, ReactiveFormsModule ],
declarations: [ AppComponent, PatternListComponent, PatternDetailComponent, WidgetListComponent,
FormComponent, DefaultWidget, LabelComponent, CheckboxWidget ],
bootstrap: [ AppComponent ],
providers: [ WidgetService ]
export class AppModule { }

Answer Source

You need to export your interface:

export interface PatternDetails {


Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download