title: Angular 2 and native Promises
body: <p>I'm having issue using native promises with second angular and typescript:</p>
  
  <pre><code>export class LoginComponent implements OnInit {
  
      public user = {};
  
      constructor( private authService:AuthenticationService) { }
  
      ngOnInit() {
      }
  
      login() {
  
          console.log( 'Connecting to server' );
  
          this.authService.login( this.user ).then(( response ) =&gt; {
  
              // works
              console.log( response['success'] );
  
              // error
              console.log( response.success ); 
  
          }, ( error ) =&gt; {
  
              console.log( error );
          });
      }
  }
  </code></pre>
  
  <p>below is simple service, with fake connect to the server:</p>
  
  <pre><code>export class AuthenticationService {
  
      // ... some code ...
  
      login( loginData ) {
  
          let self = this;
  
          return new Promise(function(resolve, reject){
  
              // fake delay - for now is no back end
              setTimeout(function() {
  
                  if ( loginData.username === 'username' &amp;&amp; loginData.password === 'password' ) {
  
                      resolve({
                          message: "Successfully logged in",
                          success: true,
                          errors: null
                      });
                  } else {
  
                      reject({
                          message: "Wrong user data reperesented",
                          success: false,
                          errors: {
                              "username": true,
                              "password": true
                          }
                      });
                  }
              }, 100);
          });
      }
  
      // ... some code ...
  }
  </code></pre>
  
  <p>Tried to search what I have to do to solve <code>Property 'success' does not exist on type '{}'.</code> error but without success.</p>