Skip to content

Instantly share code, notes, and snippets.

@mredem96 mredem96/.ts
Last active Feb 11, 2019

Embed
What would you like to do?
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
You can’t perform that action at this time.