Created
April 2, 2018 10:27
-
-
Save Nahiduzzaman/c20dc01ab82523b97c90e929a8f918c3 to your computer and use it in GitHub Desktop.
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 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