//////////////////////////////////////////////////////////////////////// // 1.1) If you saw something like this during a code review // what would you say and how would you improve it? // (If you don't know Typescript's type system well, pseudo-code it or talk about a typed language you know well.) type Shape = { type: "circle" | "square"; size: number; radius: number; }; // 1.2) On your improved type, write a function that calculates the area // 1.3) On your improved type, write a type predicate isCircle (if you know Typescript. Skip otherwise) //////////////////////////////////////////////////////////////////////// // 2.1) From an error handling perspective what's the difference // between these in node. const async1 = async () => { try { const resp = await fetch(url); return resp.json(); } catch (err) { console.error(err); throw new Error("oops"); } }; const async2 = async () => { const respPromise = fetch(url); try { return (await respPromise).json(); } catch (err) { console.error(err); throw new Error("oops"); } }; // 2.2) What else would you say about the error handling of both // during a code review