title: Typescript automatically get interface properties in a class
body: <p>Hello TypeScript experts.</p>
  
  <p>I have the following code but I have to repeat the interface properties in the class otherwise I get:</p>
  
  <blockquote>
    <p>Class incorrectly implements interface</p>
  </blockquote>
  
  <p>When using an interface, is there a TypeScript shorthand for doing this without having to declare <code>Id: number;</code> and all the other properties in the class? Thx</p>
  
  <pre><code>interface INavigation {
    Id: number;
    AppId: number;
    NavId: number;
    Name: string;
    ParentId: string;
    PageURL: string;
    Position: string;
    Active: string;
    Desktop: string;
    Tablet: string;
    Phone: string;
    RoleId: string;
    Target: string;
  }
  
  class Navigation implements INavigation {
  
    Id: number;
    AppId: number;
    NavId: number;
    Name: string;
    ParentId: string;
    PageURL: string;
    Position: string;
    Active: string;
    Desktop: string;
    Tablet: string;
    Phone: string;
    RoleId: string;
    Target: string;
  
    constructor(navigation: any) {
      this.Id = navigation.Id
      this.AppId = navigation.NavAppId
      this.NavId = navigation.NavId
      this.Name = navigation.NavName
      this.ParentId = navigation.NavParentId
      this.PageURL = navigation.NavPageURL
      this.Position = navigation.NavPosition
      this.Active = navigation.NavActive
      this.Desktop = navigation.NavDesktop
      this.Tablet = navigation.NavTablet
      this.Phone = navigation.NavPhone
      this.RoleId = navigation.NavRoleId
      this.Target = navigation.NavTarget
    }
  }
  </code></pre>