GitHub

IndexSignature

API reference for IndexSignature.

Every key parameter accepts, with values of type. The parameter is a String, Number, TemplateLiteral, Enum, Suspend or a union of them, on both its sides; another raises ValueError.

Attributes

AttributeTypeDescription
parameterAST
typeAST

Functions

__init__

__init__(parameter, type) -> None
ParameterTypeDescription
parameterAST
typeAST

selects

selects(key, options=None) -> bool

key is a value of the parameter's encoded side: a key of an input to decode.

ParameterTypeDescription
keyobject
optionsParseOptions | None = None

Returns bool

def selects(self, key: object, options: ParseOptions | None = None) -> bool:
    """``key`` is a value of the parameter's encoded side: a key of an input to decode."""
    return type(self.parameter.flip().to_type().parse(key, options or {})) is Success

selects_decoded

selects_decoded(key) -> bool

key is a value of the parameter's decoded side: a key of a decoded value, which is what derivations over decoded values (equivalence, formatter) read.

ParameterTypeDescription
keyobject

Returns bool

def selects_decoded(self, key: object) -> bool:
    """``key`` is a value of the parameter's decoded side: a key of a decoded value, which
    is what derivations over decoded values (equivalence, formatter) read."""
    return type(self.parameter.to_type().parse(key, {})) is Success