Module: T

Defined in:
lib/sorbet/eraser/t.rb,
lib/sorbet/eraser/t/enum.rb,
lib/sorbet/eraser/t/props.rb,
lib/sorbet/eraser/t/struct.rb

Overview

For some constructs, it doesn’t make as much sense to entirely remove them since they’re actually used to change runtime behavior. For example, T.absurd will always raise an error. In this case instead of removing the content, we can just shim it.

Defined Under Namespace

Modules: Configuration, Generic, Helpers, Private, Props, Sig Classes: Enum, ImmutableStruct, InexactStruct, Struct

Class Method Summary collapse

Class Method Details

.absurd(value) ⇒ Object

Absurd always raises a TypeError within Sorbet, so mirroring that behavior here when T.absurd is called.

Raises:

  • (TypeError)


72
73
74
# File 'lib/sorbet/eraser/t.rb', line 72

def self.absurd(value)
  raise TypeError, value
end

.type_aliasObject

Type aliases don’t actually do anything, but they are usually assigned to constants, so in that case we need to return something.



66
67
68
# File 'lib/sorbet/eraser/t.rb', line 66

def self.type_alias
  Object.new
end