Revert "types.optional (#114)"

This reverts commit a4b51fdd5c.
This commit is contained in:
ariel 2025-04-25 15:15:20 -04:00 committed by GitHub
parent a4b51fdd5c
commit 3b0eaae19d
Signed by: DevComp
GPG key ID: B5690EEEBB952194

View file

@ -1,19 +0,0 @@
# types.optional
## Summary
This RFC proposes adding a new method to the `types` library in type functions, that provides a shorthand for `types.unionof(type, types.singleton(nil))`.
## Motivation
Optional types occur very commonly, and it is annoying to have to always type `types.unionof(meow, types.singleton(nil))` to make a optional type, this leads to having the following appear in codebases that make use of optional types a lot in type functions:
```luau
type function optional(type)
return types.unionof(type, types.singleton(nil))
end
```
## Design
As a solution, a new method to the `types` library should be added called `optional`. This new method will act the same as `types.unionof(type, types.singleton(nil))`.