Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- interface t {
- a: string,
- b: number,
- c: string
- }
- let obj:t = {
- a: "foo",
- b: 12,
- c: "bar"
- }
- function keepWholeObject(obj_param: {x: string, y:number}){
- let {a, b}:{a: string, b: number} = obj_param;
- console.log(`In function - ${a}`);
- console.log(`In function - ${b}`);
- }
- function keepWholeObject(obj_param: { a: string, b: number }) {
- let { a, b }: { a: string, b: number } = obj_param;
- console.log(`In function - ${a}`);
- console.log(`In function - ${b}`);
- }
Add Comment
Please, Sign In to add comment