Last active
July 31, 2023 22:34
-
-
Save rchamarthi/07adc08b6f0d452be9268b4615a0397d to your computer and use it in GitHub Desktop.
Typescript extending interfaces
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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