From 690f8b7676e07c608d4d2686eb6ab95134c3b92e Mon Sep 17 00:00:00 2001 From: Kiiyoko <73446312+Kiiyoko@users.noreply.github.com> Date: Fri, 13 Dec 2024 19:09:12 -0500 Subject: [PATCH] Update generic-constraints.md oops, fixed where clause for function type --- docs/generic-constraints.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/generic-constraints.md b/docs/generic-constraints.md index 0425ab3..eed9c37 100644 --- a/docs/generic-constraints.md +++ b/docs/generic-constraints.md @@ -47,7 +47,7 @@ local function getProperty>( object: T, key: K ): index = ( object: T, key: K ) -> ( index ) where< K: keyof > +type getProperty> = ( object: T, key: K ) -> ( index ) ``` This would allow users to specify the constraints of the separately from the generic declaration itself. This would be reminiscent to users of C#. Imposing multiple constraints on different generics can be done by delimiting with `,`. This would be backwards compatible, without major performance implications, as it could just be a conditional keyword. This could be used in conjuction with option 1. > This isn't nearly as elegant for smaller types compared to option 1, but would be incredibly powerful for generics with lots of constraints. This allows for neatly distributing the declaration along multiple lines.