Skip to content

Typescript Capstone Challenge#26

Open
wasyted wants to merge 1 commit intogridu:masterfrom
wasyted:typescript-capstone-challenge
Open

Typescript Capstone Challenge#26
wasyted wants to merge 1 commit intogridu:masterfrom
wasyted:typescript-capstone-challenge

Conversation

@wasyted
Copy link
Copy Markdown

@wasyted wasyted commented Sep 18, 2025

This PR completes the TypeScript Essentials Capstone Challenge by refactoring the existing JavaScript implementation of the Observer and Observable design pattern into fully-typed TypeScript.

Changes Implemented

Generic Observer & Observable Classes:

  • The Observer and Observable classes were refactored to use generics making them highly reusable.

Strict Type and Interface Definitions:

  • Enums: Introduced HTTPMethod and HTTPStatus enums to replace raw string and magic numbers.

  • Interfaces: Added IAppRequest and ISubscription interfaces to define the shape of request objects and subscription contracts.

  • Type Aliases: Created the User and Handlers types to model the application's data and define the structure for observer handlers (next, error, complete).

Typed Mocks and Functions:

  • The userMock and requestsMock arrays are now strictly typed against the User and IAppRequest definitions. userMock is also marked as Readonly to enforce immutability.

  • All handler functions (handleRequest, handleError) and variables (requests$, subscription) have been assigned explicit types.

Acceptance Criteria Checklist

  • The code sample is fully covered with types.

TypeScript Essentials Capstone Challenge
Code sample consist of implementation of Observer, Observable and usage of this classes (handling requests). The assignment implies the coverage of the types of the entire code not only Observable & Observer but also request, users objects and observer handlers.

Acceptance criteria
The code sample should be fully covered with types.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant