Skip to content

Instantly share code, notes, and snippets.

@rchamarthi
Last active July 31, 2023 22:34
Show Gist options
  • Save rchamarthi/07adc08b6f0d452be9268b4615a0397d to your computer and use it in GitHub Desktop.
Save rchamarthi/07adc08b6f0d452be9268b4615a0397d to your computer and use it in GitHub Desktop.
Typescript extending interfaces
interface TestInterface {
name: string,
description: string;
}
interface MyTestInterface extends TestInterface {
id: number;
}
const myEvent: MyTestInterface = {
name: 'john doe',
description: 'new test customer',
id: 1
}
console.log(myEvent);
## Output
c889f3b38f7a:typescript-helloworld $ npx ts-node test.ts
{ name: 'john doe', description: 'new test customer', id: 1 }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment