Ionic 2 issue with Type Script

Hello Guys,

I m trying to develop app with Ionic 2 with tabs page. Here is my code for the controller people.ts

import {Component} from '@angular/core';
import {HomePage} from '../home/home';
import {AboutPage} from '../about/about';
import {ContactPage} from '../contact/contact';

@Component({
  templateUrl: 'build/pages/tabs/tabs.html'
})
export class TabsPage {
    
  private tab1Root: any;
  private tab2Root: any;
  private tab3Root: any;

  constructor() {
    // this tells the tabs component which Pages
    // should be each tab's root Page
    this.tab1Root = HomePage;
    this.tab2Root = AboutPage;
    this.tab3Root = ContactPage;
  }
}

I m getting following typescript error.

TypeScript error: /Applications/apps/v2/MyApp/app/pages/people/people.ts(4,9): Error TS2395: Individual declarations in merged declaration 'PeoplePage' must be all exported or all local.
TypeScript error: /Applications/apps/v2/MyApp/app/pages/people/people.ts(9,14): Error TS2395: Individual declarations in merged declaration 'PeoplePage' must be all exported or all local.

I m new to Ionic2 and typescript so not sure what it does this above error means. Please suggest me how to fix it.

Thanks

Hi developersnepal,
can you please include code for the page in question?
/Applications/apps/v2/MyApp/app/pages/people/people.ts
We won’t be able to help you otherwise.

1 Like

Zoidy is saying right… because error in people.ts page…
as per your posted trace.

Generally speaking, you want only one class per file.

This is my code for people.ts

import {Component} from '@angular/core';
import {HelloIonicPage} from '../hello-ionic/hello-ionic';
import {ListPage} from '../list/list';
import {PeoplePage} from '../people/people';          
  
@Component({
  templateUrl: 'build/pages/people/people.html'
})
export class PeoplePage  {
       
  private tab1Root: any;
  private tab2Root: any;
  private tab3Root: any;

  constructor() {
    this tells the tabs component which Pages
    // should be each tab's root Page
    this.tab1Root = HelloIonicPage;
    this.tab2Root = ListPage;
    this.tab3Root = PeoplePage;
  }
}

Don’t import PeoplePage from PeoplePage.

3 Likes