@@ -112,7 +112,11 @@ export const canUserAccess = (role: Role, action: Action) => {
112112 * ^ 🚁
113113 *
114114 * 🚁 Hover Action. Now, we're getting ALL members of ALL of the arrays.
115- * Fabulous.
115+ *
116+ * 🕵️♂️ Discuss amongst yourselves WHY you think [number] works. When you
117+ * think you've figured something out, check:
118+ *
119+ * Solution #1
116120 */
117121
118122/**
@@ -185,22 +189,12 @@ export const canUserAccess = (role: Role, action: Action) => {
185189 * possibleActions.includes(action as any)
186190 *
187191 * It works? Nice.
188- */
189-
190- /**
191- * 💡 Often, when doing more advanced typings, you're going to find
192- * that casting to any is the most productive solution in your arsenal.
193- * Many libraries doing advanced TS work, like TRPC and Zod, use 'any'
194- * liberally.
195- *
196- * Because TypeScript is fundamentally not a sound type system (because
197- * JavaScript itself is unsound), you will occasionally need to use any's
198- * in _some places_ in your apps. My opinion is that the best place for
199- * them is hidden away in useful functions, like the one above. Any's for
200- * the function creator, not the function consumer.
201- *
202- * For the curious - yes, I found a different solution -
203- * ReadonlyArray<Action> - which I'll explain in the break.
192+ *
193+ * 🕵️♂️ Discuss amongst yourselves: is this a good solution? What
194+ * problems could you imagine coming up against for this? Should
195+ * any _ever_ be used?
196+ *
197+ * For my thoughts, see Solution 2:
204198 */
205199
206200/**
0 commit comments