Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
TypeScriptToLua/src/TSTLErrors.ts at master · lineCode/TypeScriptToLua · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
Platform
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
Solutions
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
See all industries
View all solutions
Resources
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
Open Source
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
Enterprise
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
lineCode
TypeScriptToLua
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
TypeScriptToLua
/
src
/
TSTLErrors.ts
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
183 lines (140 loc) · 8.41 KB
master
Breadcrumbs
TypeScriptToLua
/
src
/
TSTLErrors.ts
Copy path
Top
File metadata and controls
Code
Blame
183 lines (140 loc) · 8.41 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
import
*
as
ts
from
"typescript"
;
import
{
LuaTarget
}
from
"./CompilerOptions"
;
import
{
TranspileError
}
from
"./TranspileError"
;
const
getLuaTargetName
=
(
version
:
LuaTarget
)
=>
(
version
===
LuaTarget
.
LuaJIT
?
"LuaJIT"
:
`Lua
${
version
}
`
)
;
export
const
CouldNotCast
=
(
castName
:
string
)
=>
new
Error
(
`Failed to cast all elements to expected type using
${
castName
}
.`
)
;
export
const
ForbiddenForIn
=
(
node
:
ts
.
Node
)
=>
new
TranspileError
(
`Iterating over arrays with 'for ... in' is not allowed.`
,
node
)
;
export
const
ForbiddenLuaTableNonDeclaration
=
(
node
:
ts
.
Node
)
=>
new
TranspileError
(
`Classes with the '@luaTable' decorator must be declared.`
,
node
)
;
export
const
InvalidExtendsLuaTable
=
(
node
:
ts
.
Node
)
=>
new
TranspileError
(
`Cannot extend classes with the decorator '@luaTable'.`
,
node
)
;
export
const
InvalidInstanceOfLuaTable
=
(
node
:
ts
.
Node
)
=>
new
TranspileError
(
`The instanceof operator cannot be used with a '@luaTable' class.`
,
node
)
;
export
const
ForbiddenLuaTableUseException
=
(
description
:
string
,
node
:
ts
.
Node
)
=>
new
TranspileError
(
`Invalid @luaTable usage:
${
description
}
`
,
node
)
;
export
const
InvalidDecoratorArgumentNumber
=
(
name
:
string
,
got
:
number
,
expected
:
number
,
node
:
ts
.
Node
)
=>
new
TranspileError
(
`
${
name
}
expects
${
expected
}
argument(s) but got
${
got
}
.`
,
node
)
;
export
const
InvalidDecoratorContext
=
(
node
:
ts
.
Node
)
=>
new
TranspileError
(
`Decorator function cannot have 'this: void'.`
,
node
)
;
export
const
InvalidExtensionMetaExtension
=
(
node
:
ts
.
Node
)
=>
new
TranspileError
(
`Cannot use both '@extension' and '@metaExtension' decorators on the same class.`
,
node
)
;
export
const
InvalidNewExpressionOnExtension
=
(
node
:
ts
.
Node
)
=>
new
TranspileError
(
`Cannot construct classes with decorator '@extension' or '@metaExtension'.`
,
node
)
;
export
const
InvalidExportDeclaration
=
(
declaration
:
ts
.
ExportDeclaration
)
=>
new
TranspileError
(
"Encountered invalid export declaration without exports and without module."
,
declaration
)
;
export
const
InvalidExtendsExtension
=
(
node
:
ts
.
Node
)
=>
new
TranspileError
(
`Cannot extend classes with decorator '@extension' or '@metaExtension'.`
,
node
)
;
export
const
InvalidExportsExtension
=
(
node
:
ts
.
Node
)
=>
new
TranspileError
(
`Cannot export classes with decorator '@extension' or '@metaExtension'.`
,
node
)
;
export
const
InvalidInstanceOfExtension
=
(
node
:
ts
.
Node
)
=>
new
TranspileError
(
`Cannot use instanceof on classes with decorator '@extension' or '@metaExtension'.`
,
node
)
;
export
const
InvalidJsonFileContent
=
(
node
:
ts
.
Node
)
=>
new
TranspileError
(
"Invalid JSON file content"
,
node
)
;
export
const
InvalidPropertyCall
=
(
node
:
ts
.
Node
)
=>
new
TranspileError
(
`Tried to transpile a non-property call as property call.`
,
node
)
;
export
const
InvalidElementCall
=
(
node
:
ts
.
Node
)
=>
new
TranspileError
(
`Tried to transpile a non-element call as an element call.`
,
node
)
;
export
const
ForbiddenStaticClassPropertyName
=
(
node
:
ts
.
Node
,
name
:
string
)
=>
new
TranspileError
(
`Cannot use "
${
name
}
" as a static class property or method name.`
,
node
)
;
export
const
MissingClassName
=
(
node
:
ts
.
Node
)
=>
new
TranspileError
(
`Class declarations must have a name.`
,
node
)
;
export
const
MissingForOfVariables
=
(
node
:
ts
.
Node
)
=>
new
TranspileError
(
"Transpiled ForOf variable declaration list contains no declarations."
,
node
)
;
export
const
MissingFunctionName
=
(
declaration
:
ts
.
FunctionLikeDeclaration
)
=>
new
TranspileError
(
"Unsupported function declaration without name."
,
declaration
)
;
export
const
MissingMetaExtension
=
(
node
:
ts
.
Node
)
=>
new
TranspileError
(
`@metaExtension requires the extension of the metatable class.`
,
node
)
;
export
const
NonFlattenableDestructure
=
(
node
:
ts
.
Node
)
=>
new
TranspileError
(
`This node cannot be destructured using a standard Lua assignment statement.`
,
node
)
;
export
const
UndefinedFunctionDefinition
=
(
functionSymbolId
:
number
)
=>
new
Error
(
`Function definition for function symbol
${
functionSymbolId
}
is undefined.`
)
;
export
const
UnsupportedForInVariable
=
(
initializer
:
ts
.
Node
)
=>
new
TranspileError
(
`Unsuppored for-in variable kind.`
,
initializer
)
;
export
const
UndefinedScope
=
(
)
=>
new
Error
(
"Expected to pop a scope, but found undefined."
)
;
export
const
UndefinedTypeNode
=
(
node
:
ts
.
Node
)
=>
new
TranspileError
(
"Failed to resolve required type node."
,
node
)
;
export
const
UnknownSuperType
=
(
node
:
ts
.
Node
)
=>
new
TranspileError
(
"Unable to resolve type of super expression."
,
node
)
;
export
const
UnsupportedImportType
=
(
node
:
ts
.
Node
)
=>
new
TranspileError
(
`Unsupported import type.`
,
node
)
;
export
const
UnsupportedKind
=
(
description
:
string
,
kind
:
ts
.
SyntaxKind
,
node
:
ts
.
Node
)
=>
new
TranspileError
(
`Unsupported
${
description
}
kind:
${
ts
.
SyntaxKind
[
kind
]
}
`
,
node
)
;
export
const
UnsupportedProperty
=
(
parentName
:
string
,
property
:
string
,
node
:
ts
.
Node
)
=>
new
TranspileError
(
`Unsupported property on
${
parentName
}
:
${
property
}
`
,
node
)
;
export
const
UnsupportedForTarget
=
(
functionality
:
string
,
version
:
LuaTarget
,
node
:
ts
.
Node
)
=>
new
TranspileError
(
`
${
functionality
}
is/are not supported for target
${
getLuaTargetName
(
version
)
}
.`
,
node
)
;
export
const
UnsupportedFunctionWithoutBody
=
(
node
:
ts
.
FunctionLikeDeclaration
)
=>
new
TranspileError
(
"Functions with undefined bodies are not supported."
,
node
)
;
export
const
UnsupportedNoSelfFunctionConversion
=
(
node
:
ts
.
Node
,
name
?:
string
)
=>
{
if
(
name
)
{
return
new
TranspileError
(
`Unable to convert function with a 'this' parameter to function "
${
name
}
" with no 'this'. `
+
`To fix, wrap in an arrow function, or declare with 'this: void'.`
,
node
)
;
}
else
{
return
new
TranspileError
(
`Unable to convert function with a 'this' parameter to function with no 'this'. `
+
`To fix, wrap in an arrow function, or declare with 'this: void'.`
,
node
)
;
}
}
;
export
const
UnsupportedSelfFunctionConversion
=
(
node
:
ts
.
Node
,
name
?:
string
)
=>
{
if
(
name
)
{
return
new
TranspileError
(
`Unable to convert function with no 'this' parameter to function "
${
name
}
" with 'this'. `
+
`To fix, wrap in an arrow function or declare with 'this: any'.`
,
node
)
;
}
else
{
return
new
TranspileError
(
`Unable to convert function with no 'this' parameter to function with 'this'. `
+
`To fix, wrap in an arrow function or declare with 'this: any'.`
,
node
)
;
}
}
;
export
const
UnsupportedOverloadAssignment
=
(
node
:
ts
.
Node
,
name
?:
string
)
=>
{
if
(
name
)
{
return
new
TranspileError
(
`Unsupported assignment of function with different overloaded types for 'this' to "
${
name
}
". `
+
`Overloads should all have the same type for 'this'.`
,
node
)
;
}
else
{
return
new
TranspileError
(
`Unsupported assignment of function with different overloaded types for 'this'. `
+
`Overloads should all have the same type for 'this'.`
,
node
)
;
}
}
;
export
const
UnsupportedNonDestructuringLuaIterator
=
(
node
:
ts
.
Node
)
=>
{
return
new
TranspileError
(
"Unsupported use of lua iterator with TupleReturn decorator in for...of statement. "
+
"You must use a destructuring statement to catch results from a lua iterator with "
+
"the TupleReturn decorator."
,
node
)
;
}
;
export
const
UnresolvableRequirePath
=
(
node
:
ts
.
Node
,
reason
:
string
,
path
?:
string
)
=>
{
return
new
TranspileError
(
`
${
reason
}
. `
+
`TypeScript path:
${
path
}
.`
,
node
)
;
}
;
export
const
ReferencedBeforeDeclaration
=
(
node
:
ts
.
Identifier
)
=>
{
return
new
TranspileError
(
`Identifier "
${
node
.
text
}
" was referenced before it was declared. The declaration `
+
"must be moved before the identifier's use, or hoisting must be enabled."
,
node
)
;
}
;
export
const
UnsupportedObjectDestructuringInForOf
=
(
node
:
ts
.
Node
)
=>
{
return
new
TranspileError
(
`Unsupported object destructuring in for...of statement.`
,
node
)
;
}
;
export
const
InvalidAmbientIdentifierName
=
(
node
:
ts
.
Identifier
)
=>
{
return
new
TranspileError
(
`Invalid ambient identifier name "
${
node
.
text
}
". Ambient identifiers must be valid lua identifiers.`
,
node
)
;
}
;
export
const
InvalidForRangeCall
=
(
node
:
ts
.
Node
,
message
:
string
)
=>
{
return
new
TranspileError
(
`Invalid @forRange call:
${
message
}
`
,
node
)
;
}
;
You can’t perform that action at this time.