Skip to content

types

luau
local types = require("@std/syntax/types")

WARNING

These APIs are still open to future evolution. In new major versions, they may change in backwards incompatible ways.

Summary

EntryDescription
CstAttribute
CstElseIfExpr
CstElseIfStat
CstEof
CstExpr
CstExprBinary
CstExprCall
CstExprConstantBool
CstExprConstantInteger
CstExprConstantNil
CstExprConstantNumber
CstExprConstantString
CstExprFunction
CstExprGlobal
CstExprGroup
CstExprIfElse
CstExprIndexExpr
CstExprIndexName
CstExprInstantiate
CstExprInterpString
CstExprLocal
CstExprTable
CstExprTypeAssertion
CstExprUnary
CstExprVarargs
CstFunctionTypeParameter
CstGenericType
CstGenericTypePack
CstLocal
CstNode
CstStat
CstStatAssign
CstStatBlock
CstStatBreak
CstStatCompoundAssign
CstStatConst
CstStatContinue
CstStatDo
CstStatExpr
CstStatFor
CstStatForIn
CstStatFunction
CstStatIf
CstStatLocal
CstStatLocalFunction
CstStatRepeat
CstStatReturn
CstStatTypeAlias
CstStatTypeFunction
CstStatWhile
CstTableExprGeneralItem
CstTableExprItem
CstTableExprListItem
CstTableExprRecordItem
CstTableTypeItem
CstTableTypeItemIndexer
CstTableTypeItemProperty
CstTableTypeItemStringProperty
CstType
CstTypeArray
CstTypeFunction
CstTypeGroup
CstTypeIntersection
CstTypeOptional
CstTypePack
CstTypePackExplicit
CstTypePackGeneric
CstTypePackVariadic
CstTypeReference
CstTypeSingletonBool
CstTypeSingletonString
CstTypeTable
CstTypeTypeof
CstTypeUnion
MultiLineComment
ParseResult
ReplacementThe type of a replacement for a CST node.
ReplacementsA mapping of CST nodes to their replacements, used with @std/syntax/printer and lute transform to specify how CSTs should be mutated.
SingleLineComment
Span
Trivia
Type
TypePack
Whitespace

Types

CstAttribute

luau
type CstAttribute = luau.CstAttribute

CstElseIfExpr

luau
type CstElseIfExpr = luau.CstElseIfExpr

CstElseIfStat

luau
type CstElseIfStat = luau.CstElseIfStat

CstEof

luau
type CstEof = luau.CstEof

CstExpr

luau
type CstExpr = luau.CstExpr

CstExprBinary

luau
type CstExprBinary = luau.CstExprBinary

CstExprCall

luau
type CstExprCall = luau.CstExprCall

CstExprConstantBool

luau
type CstExprConstantBool = luau.CstExprConstantBool

CstExprConstantInteger

luau
type CstExprConstantInteger = luau.CstExprConstantInteger

CstExprConstantNil

luau
type CstExprConstantNil = luau.CstExprConstantNil

CstExprConstantNumber

luau
type CstExprConstantNumber = luau.CstExprConstantNumber

CstExprConstantString

luau
type CstExprConstantString = luau.CstExprConstantString

CstExprFunction

luau
type CstExprFunction = luau.CstExprFunction

CstExprGlobal

luau
type CstExprGlobal = luau.CstExprGlobal

CstExprGroup

luau
type CstExprGroup = luau.CstExprGroup

CstExprIfElse

luau
type CstExprIfElse = luau.CstExprIfElse

CstExprIndexExpr

luau
type CstExprIndexExpr = luau.CstExprIndexExpr

CstExprIndexName

luau
type CstExprIndexName = luau.CstExprIndexName

CstExprInstantiate

luau
type CstExprInstantiate = luau.CstExprInstantiate

CstExprInterpString

luau
type CstExprInterpString = luau.CstExprInterpString

CstExprLocal

luau
type CstExprLocal = luau.CstExprLocal

CstExprTable

luau
type CstExprTable = luau.CstExprTable

CstExprTypeAssertion

luau
type CstExprTypeAssertion = luau.CstExprTypeAssertion

CstExprUnary

luau
type CstExprUnary = luau.CstExprUnary

CstExprVarargs

luau
type CstExprVarargs = luau.CstExprVarargs

CstFunctionTypeParameter

luau
type CstFunctionTypeParameter = luau.CstFunctionTypeParameter

CstGenericType

luau
type CstGenericType = luau.CstGenericType

CstGenericTypePack

luau
type CstGenericTypePack = luau.CstGenericTypePack

CstLocal

luau
type CstLocal = luau.CstLocal

CstNode

luau
type CstNode = luau.CstNode

CstStat

luau
type CstStat = luau.CstStat

CstStatAssign

luau
type CstStatAssign = luau.CstStatAssign

CstStatBlock

luau
type CstStatBlock = luau.CstStatBlock

CstStatBreak

luau
type CstStatBreak = luau.CstStatBreak

CstStatCompoundAssign

luau
type CstStatCompoundAssign = luau.CstStatCompoundAssign

CstStatConst

luau
type CstStatConst = luau.CstStatConst

CstStatContinue

luau
type CstStatContinue = luau.CstStatContinue

CstStatDo

luau
type CstStatDo = luau.CstStatDo

CstStatExpr

luau
type CstStatExpr = luau.CstStatExpr

CstStatFor

luau
type CstStatFor = luau.CstStatFor

CstStatForIn

luau
type CstStatForIn = luau.CstStatForIn

CstStatFunction

luau
type CstStatFunction = luau.CstStatFunction

CstStatIf

luau
type CstStatIf = luau.CstStatIf

CstStatLocal

luau
type CstStatLocal = luau.CstStatLocal

CstStatLocalFunction

luau
type CstStatLocalFunction = luau.CstStatLocalFunction

CstStatRepeat

luau
type CstStatRepeat = luau.CstStatRepeat

CstStatReturn

luau
type CstStatReturn = luau.CstStatReturn

CstStatTypeAlias

luau
type CstStatTypeAlias = luau.CstStatTypeAlias

CstStatTypeFunction

luau
type CstStatTypeFunction = luau.CstStatTypeFunction

CstStatWhile

luau
type CstStatWhile = luau.CstStatWhile

CstTableExprGeneralItem

luau
type CstTableExprGeneralItem = luau.CstTableExprGeneralItem

CstTableExprItem

luau
type CstTableExprItem = luau.CstTableExprItem

CstTableExprListItem

luau
type CstTableExprListItem = luau.CstTableExprListItem

CstTableExprRecordItem

luau
type CstTableExprRecordItem = luau.CstTableExprRecordItem

CstTableTypeItem

luau
type CstTableTypeItem = luau.CstTableTypeItem

CstTableTypeItemIndexer

luau
type CstTableTypeItemIndexer = luau.CstTableTypeItemIndexer

CstTableTypeItemProperty

luau
type CstTableTypeItemProperty = luau.CstTableTypeItemProperty

CstTableTypeItemStringProperty

luau
type CstTableTypeItemStringProperty = luau.CstTableTypeItemStringProperty

CstType

luau
type CstType = luau.CstType

CstTypeArray

luau
type CstTypeArray = luau.CstTypeArray

CstTypeFunction

luau
type CstTypeFunction = luau.CstTypeFunction

CstTypeGroup

luau
type CstTypeGroup = luau.CstTypeGroup

CstTypeIntersection

luau
type CstTypeIntersection = luau.CstTypeIntersection

CstTypeOptional

luau
type CstTypeOptional = luau.CstTypeOptional

CstTypePack

luau
type CstTypePack = luau.CstTypePack

CstTypePackExplicit

luau
type CstTypePackExplicit = luau.CstTypePackExplicit

CstTypePackGeneric

luau
type CstTypePackGeneric = luau.CstTypePackGeneric

CstTypePackVariadic

luau
type CstTypePackVariadic = luau.CstTypePackVariadic

CstTypeReference

luau
type CstTypeReference = luau.CstTypeReference

CstTypeSingletonBool

luau
type CstTypeSingletonBool = luau.CstTypeSingletonBool

CstTypeSingletonString

luau
type CstTypeSingletonString = luau.CstTypeSingletonString

CstTypeTable

luau
type CstTypeTable = luau.CstTypeTable

CstTypeTypeof

luau
type CstTypeTypeof = luau.CstTypeTypeof

CstTypeUnion

luau
type CstTypeUnion = luau.CstTypeUnion

MultiLineComment

luau
type MultiLineComment = luau.MultiLineComment

ParseResult

luau
type ParseResult = luau.ParseResult

Replacement

The type of a replacement for a CST node.

A replacement can be:

  1. A string, which will be used as the replacement text for the node, with any surrounding trivia preserved.

  2. An object with a content property containing the replacement string, and an optional preserveTrivia boolean property.

If preserveTrivia is true, the replaced CST node's attached trivia (whitespace and comments) will be reserialized with the replacement content.

If false, the trivia will be discarded. If omitted, trivia is preserved by default.

Note that trailing trivia for a token consists of all whitespace and comments that follow it up to and including a newline.

Any trivia after the first seen newline is considered leading trivia for the next token.

luau
type Replacement = string | { content: string, preserveTrivia: boolean? }

Replacements

A mapping of CST nodes to their replacements, used with @std/syntax/printer and lute transform to specify how CSTs should be mutated.

luau
type Replacements = { [CstNode]: Replacement }

SingleLineComment

luau
type SingleLineComment = luau.SingleLineComment

Span

luau
type Span = luau.Span

Trivia

luau
type Trivia = luau.Trivia

Type

luau
type Type = luau.Type

TypePack

luau
type TypePack = luau.TypePack

Whitespace

luau
type Whitespace = luau.Whitespace