Skip to content

Instantly share code, notes, and snippets.

@Nahiduzzaman
Created April 2, 2018 10:27
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 Nahiduzzaman/c20dc01ab82523b97c90e929a8f918c3 to your computer and use it in GitHub Desktop.
Save Nahiduzzaman/c20dc01ab82523b97c90e929a8f918c3 to your computer and use it in GitHub Desktop.
interface Obj {
x: number;
y: number;
name: string;
}
//let a = {} as Obj;
let a = <Obj> {} ;
a.x = 232;
console.log(a);
-----------------------------------
interface Obj {
x ?: number;
y ?: number;
name ?: string;
}
let a : Obj = {} ; // this syntax will give error if you don't have optional parameter.
a.x = 232;
console.log(a);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment