-
-
Save mredem96/9168394048e9ca85afe9099791b69586 to your computer and use it in GitHub Desktop.
Shape
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
function registerUser(user:{name:string,age:number,gender:string}){ | |
.... /// some function implementation | |
} | |
// let's define some shapes | |
//ok | |
let person1={ | |
name:'Hojiakbar', | |
age:22, | |
gender:'male' | |
}; | |
// order not important shape important | |
// ok | |
let person2={ | |
name:'Hojiakbar', | |
gender:'male', | |
age:22, | |
occupation:'student & developer' | |
} | |
// this is not Ok give an error and our Shape is not fulled typescript compliant about it | |
// we have too full the the our defining shape in order to make happy typescipt | |
let person3={ | |
name:'Hojiakbar', | |
gender:'male' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment