mirror of
https://github.com/luau-lang/luau.git
synced 2025-05-04 10:33:46 +01:00
Update syntax-default-type-alias-type-parameters.md
Even more examples
This commit is contained in:
parent
ce6cc9c162
commit
079766a0b0
1 changed files with 6 additions and 5 deletions
|
@ -49,10 +49,11 @@ type A<T, U = V, V = T> = ... -- not allowed
|
||||||
Default type parameter values are also allowed for type packs:
|
Default type parameter values are also allowed for type packs:
|
||||||
```lua
|
```lua
|
||||||
type A<T, U... = ...string> -- ok, variadic type pack
|
type A<T, U... = ...string> -- ok, variadic type pack
|
||||||
|
type B<T, U... = ()> -- ok, type pack with no elements
|
||||||
type C<T, U... = (string)> -- ok, type pack with one element
|
type C<T, U... = (string)> -- ok, type pack with one element
|
||||||
type C<T, U... = (string,number)> -- ok, type pack with two elements
|
type D<T, U... = (string, number)> -- ok, type pack with two elements
|
||||||
type C<T, U... = ()> -- ok, type pack with no elements
|
type E<T, U... = (string, ...number)> -- ok, variadic type pack with a different first element
|
||||||
type D<T..., U... = T...> -- ok
|
type F<T..., U... = T...> -- ok, same type pack as T...
|
||||||
```
|
```
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
Loading…
Add table
Reference in a new issue