One list of roles
One list can define which role names the program accepts.
your task
Derive Role from the supplied ROLES list. Make a successful isRole check tell TypeScript the input is a Role. Both versions must compile and reject names outside their own list.
roles.ts copies the role names by hand. The caller also gets a type error after isRole returns true. TypeScript still treats the checked value as ordinary text.
Run checks compiles your file once for each check. Later checks use changed files. Open a file in its row to see what changed. Your code does not run. The exercise is solved when every check passes.
Starter code
or press Ctrl EnterNot run yet
checks
Not run yetOriginal rolesThis check uses the supplied files as they are. The list contains guest, member, and admin.
Expected result: no type errors.
Not run yetRoles with owner addedThe team that owns role-list.ts added “owner”. The caller now uses that role.
Expected result: no type errors.