Skip to content

Commit

Permalink
Update types.rb
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldrapper committed Jan 17, 2025
1 parent 0ac7aa5 commit 349c6f9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/literal/types.rb
Original file line number Diff line number Diff line change
Expand Up @@ -304,11 +304,17 @@ def _Lambda?
NilableLambdaType
end

# ```ruby
# _Map(name: String, age: Integer)
# ```
def _Map(...)
MapType.new(...)
end

# Nilable version of `_Map`
# ```ruby
# _Map?(name: String, age: Integer)
# ```
def _Map?(...)
NilableType.new(
MapType.new(...)
Expand Down Expand Up @@ -413,11 +419,17 @@ def _Truthy
end

# Matches if the value is an `Array` and each element matches the given types in order.
# ```ruby
# _Tuple(String, Integer, Integer)
# ```
def _Tuple(...)
TupleType.new(...)
end

# Nilable version of `_Typle`
# ```ruby
# _Tuple?(String, Integer, Integer)
# ```
def _Tuple?(...)
NilableType.new(
TupleType.new(...)
Expand Down

0 comments on commit 349c6f9

Please sign in to comment.