From 545f27971da2e45108df9429fe45ae648d5656b1 Mon Sep 17 00:00:00 2001 From: Yaxraj Dabhi <76819134+Yaxraj-rajput@users.noreply.github.com> Date: Thu, 29 Aug 2024 13:06:07 +0530 Subject: [PATCH] Update myObjects.ts before: function createUser({name: string, isPaid: boolean}){} which directly tries to assign type to destructuring syntax which is not valid way of doing and leaves the type any only after: function createUser({name, isPaid} : {name: string, isPaid: boolean}){} first destruct the object then assign types to destructured fields --- 02basics/myObjects.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/02basics/myObjects.ts b/02basics/myObjects.ts index dafba8c..ac11946 100644 --- a/02basics/myObjects.ts +++ b/02basics/myObjects.ts @@ -4,7 +4,8 @@ // isAvtive: true // } -// function createUser({name: string, isPaid: boolean}){} +// destruct the object passed as parameter and assign datatype to it +// function createUser({name, isPaid} : {name: string, isPaid: boolean}){} // let newUser = {name: "hitesh", isPaid: false, email: "h@h.com"} @@ -69,4 +70,4 @@ myUser.email = "h@gmail.com" -export {} \ No newline at end of file +export {}