Posts

Showing posts from September, 2024

12.2 Advance typescript

 create a folder initialize it : npx init -y  now initialize it with typescript : npx tsc --init update ts config of "outdir" and "rootdir" to "./dits" and "./src" , code interface user {  name : string; age: number; }; function someOfAge (User1: user , User2: user) { return User1.age + User2.age; } const age = someOfAge({name: " dhrup sinha" , age: 20},  {name: " simran sinha" , age0: 205}) console.log(age); run the code command :  tsc -b  OR npx tsc -b  Pike:   The Pike general type in Script is a powerful feature that allow you to constructs new type by selecting a subset of properties from on existing type / Interface, enhance type safety and code readability without redundancy. syntax:- Pike < type key | 'key' | 'key' >; code Interface user( id :string; name: string; age: number; email: string; password: string; }; type UpdateProp = Pike< User, "name" | 'age' | 'email'...