Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface FooBarCreateDto {
- plop: string;
- baz?: string | undefined;
- }
- interface FooBarDto extends FooBarCreateDto {
- id: string;
- plop: string;
- baz: string;
- }
- function createOrUpdateFooBar(fooBar: FooBarCreateDto | FooBarDto) {
- if (fooBar.id) { // Error id does not exist on type FooBarCreateDto | FooBarDto
- // update fooBar
- }
- // create fooBar
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement