Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Narrow type for logos array using as const #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

thebaba44
Copy link

Obstacle encountered

The logos type is wide. There's no autocomplete in exercise "Art directed Grid - 02 Grid Class Composition"

ภาพ

The exercise comment suggests that the record type will perform type checking to catch incorrect row / column entries

/*
  🦺 The two TypeScript 'Records' below ensure that the lookup objects 
  have keys that match the possible values of the 'column' and 'row'
  properties on the 'logos' array.
*/

Solution

This PR appends as const to the logos array in all exercises to narrow the logos type, providing object fields auto complete and warn users if they provided an incorrect row / column number
ภาพ

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.

None yet

1 participant