Nativescript-angular: Modal dialog error: "Two different types with this name exist, but they are unrelated"

Created on 19 Jan 2017  路  1Comment  路  Source: NativeScript/nativescript-angular

Trying to open a dialog:

const options: ModalDialogOptions = {
    context: { promptMsg: "Add a new contact" },
    fullscreen: fullscreen,
    viewContainerRef: this.vcRef
};

this.modal.showModal(ModalContent, options)

I get this compiler error:

file: 'file:///Users/me/projects/myproject/app.component.ts' severity: 'Error' message: 'Type '{ context: { promptMsg: string; }; fullscreen: boolean; viewContainerRef: ViewContainerRef; }' is not assignable to type 'ModalDialogOptions'. Types of property 'viewContainerRef' are incompatible. Type 'ViewContainerRef' is not assignable to type 'ViewContainerRef'. Two different types with this name exist, but they are unrelated. Types of property 'createComponent' are incompatible. Type '<C>(componentFactory: ComponentFactory<C>, index?: number, injector?: Injector, projectableNodes?...' is not assignable to type '<C>(componentFactory: ComponentFactory<C>, index?: number, injector?: Injector, projectableNodes?...'. Two different types with this name exist, but they are unrelated. Types of parameters 'componentFactory' and 'componentFactory' are incompatible. Type 'ComponentFactory<any>' is not assignable to type 'ComponentFactory<any>'. Two different types with this name exist, but they are unrelated. Types have separate declarations of a private property '_viewClass'.' at: '63,11' source: 'ts'

question

Most helpful comment

I have seen this error when the app contains two versions of the Angular codebase: usually one in node_modules/@angular/..., another in node_modules/nativescript-angular/node_modules/@angular/....

The solution is to make sure your Angular-related project dependencies have the same versions as the ones that nativescript-angular depends on.

>All comments

I have seen this error when the app contains two versions of the Angular codebase: usually one in node_modules/@angular/..., another in node_modules/nativescript-angular/node_modules/@angular/....

The solution is to make sure your Angular-related project dependencies have the same versions as the ones that nativescript-angular depends on.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ignaciofuentes picture ignaciofuentes  路  31Comments

plackowski picture plackowski  路  24Comments

hamorphis picture hamorphis  路  38Comments

rowdyrabouw picture rowdyrabouw  路  34Comments

jlooper picture jlooper  路  57Comments