Class: CustomElementsManifestParser::DataTypes::Type

Inherits:
BaseStruct
  • Object
show all
Defined in:
lib/custom_elements_manifest_parser/data_types/type.rb

Overview

Documents a JSDoc, Closure, or TypeScript type.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#referencesnil, ...

Returns nil, Array - An array of references to the types in the type string. These references have optional indices into the type string so that tools can understand the references in the type string independently of the type system and syntax. For example, a documentation viewer could display the type Array<FooElement | BarElement> with cross-references to FooElement and BarElement without understanding arrays, generics, or union types.

Returns:

  • (nil, Array<TypeReference> - An array of references to the types in the type string. These references have optional indices into the type string so that tools can understand the references in the type string independently of the type system and syntax. For example, a documentation viewer could display the type `Array<FooElement | BarElement>` with cross-references to `FooElement` and `BarElement` without understanding arrays, generics, or union types.)

    nil, Array - An array of references to the types in the type string. These references have optional indices into the type string so that tools can understand the references in the type string independently of the type system and syntax. For example, a documentation viewer could display the type Array<FooElement | BarElement> with cross-references to FooElement and BarElement without understanding arrays, generics, or union types.



21
# File 'lib/custom_elements_manifest_parser/data_types/type.rb', line 21

attribute :references, Types::Strict::Array.optional.meta(required: false)

#sourcenil, SourceReference

Returns:



25
# File 'lib/custom_elements_manifest_parser/data_types/type.rb', line 25

attribute :source, Types::Nominal::Any.optional.meta(required: false)

Instance Method Details

#visit(parser:) ⇒ Object



27
28
29
30
31
# File 'lib/custom_elements_manifest_parser/data_types/type.rb', line 27

def visit(parser:)
  hash = {}
  hash[:references] = references.map { |reference| parser.data_types[:type_reference].new(reference).visit(parser: parser) } unless references.nil?
  new(hash)
end