Skip to content

Instantly share code, notes, and snippets.

@mredem96
Last active February 11, 2019 12:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mredem96/9168394048e9ca85afe9099791b69586 to your computer and use it in GitHub Desktop.
Save mredem96/9168394048e9ca85afe9099791b69586 to your computer and use it in GitHub Desktop.
Shape
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