Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. interface FooBarCreateDto {
  2. plop: string;
  3. baz?: string | undefined;
  4. }
  5.  
  6. interface FooBarDto extends FooBarCreateDto {
  7. id: string;
  8. plop: string;
  9. baz: string;
  10. }
  11.  
  12. function createOrUpdateFooBar(fooBar: FooBarCreateDto | FooBarDto) {
  13. if (fooBar.id) { // Error id does not exist on type FooBarCreateDto | FooBarDto
  14. // update fooBar
  15. }
  16. // create fooBar
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement