linkedin / css-blocks

High performance, maintainable stylesheets.
http://css-blocks.com/
BSD 2-Clause "Simplified" License
6.33k stars 152 forks source link

refactor: Better return type for eachAnalyzedAttribute. #406

Closed chriseppstein closed 4 years ago

chriseppstein commented 4 years ago

The use of a tuple destructuring caused data that was correlated to become uncorrelated to the type checker. By returning an object with a type discriminator, the code paths all get the correctly associated types, which allows the knowledge we had earlier about the state of our data to be transmitted in code instead of in our heads.