TypeScript error for Page as Component when going from TS 2.3 to 2.4.2

I have been using TypeScript 2.3. My vscode has version 2.4.2, so I though I would try swapping to this.

I have a simple page…

import { Component } from '@angular/core';

@Component({
  selector: 'page-startup',
  templateUrl: 'startup.html'
})

export class StartupPage {
  constructor() {}  
}

In my app.component.ts, I have the following declaration…

public rootPage: Component = StartupPage;

I always like to have stuff as strongley typed as possible, so I have the page of type Component.

When I swap to TS 2.4.2, it suddenly does not like this any more. I get the error…

[ts] Type 'typeof StartupPage' has no properties in common with type 'Component'.

I know I can just swap the type to any, but just wondering why this is suddenly s type error, since the page is a Component?

Thanks in advance

Ionic currently supports Typescript 2.3.4:

Stay with that version until there is an update on Ionic side or you will get exactly these errors as the code itself was not yet updated.

1 Like

Ah ok, yep I’ll stay with the 2.3. Thanks.

1 Like