Courses/TypeScript MasteryLesson 50 of 56·TypescriptDeno – Secure Runtime for TypeScript20 minutesCourse progress89%Lesson content with backticks removed for testingMake it stickPractice what you've learned1 quiz · 3 practical tests · Optional activities from TypeScript MasteryBrowse activitiesQuiz 1Course Quiz12 questions · Pass mark: 70%Start quizPractical test 1Array Filter – Return Even NumbersWrite a generic function `filterEven<T>(arr: T[]): T[]` that returns only the even numbers when `T` is `number`. For non‑number arrays it should return an empty array. **Requirements** - Use a type guard to check element type. - Do not use `any`. - Return a new array, never mutate the input. Start practical testPractical test 2Async Data FetcherCreate a function `fetchJson<T>(url: string): Promise<T>` that fetches JSON from the given URL and returns a typed result. - Use the built‑in `fetch` API. - Parse the response with `response.json()`. - The function must be generic and return a `Promise<T>`. Start practical testPractical test 3Typed Event EmitterImplement a minimal strongly‑typed event emitter class `TypedEventEmitter<E>` where `E` is a mapping from event name to payload type. - Method `on<K extends keyof E>(event: K, listener: (payload: E[K]) => void): void`. - Method `emit<K extends keyof E>(event: K, payload: E[K]): void`. - Store listeners internally. Start practical test