@@ -4,28 +4,23 @@ import {TranspileError} from "./TranspileError";
44import { TSHelper as tsHelper } from "./TSHelper" ;
55
66export class TSTLErrors {
7- public static CouldNotFindEnumMember =
8- ( enumDeclaration : ts . EnumDeclaration , enumMember : string , node : ts . Node ) => new TranspileError (
9- `Could not find ${ enumMember } in ${ enumDeclaration . name . text } ` , node
10- ) ;
7+ public static CouldNotFindEnumMember = ( enumDeclaration : ts . EnumDeclaration , enumMember : string , node : ts . Node ) =>
8+ new TranspileError ( `Could not find ${ enumMember } in ${ enumDeclaration . name . text } ` , node ) ;
119
1210 public static DefaultImportsNotSupported = ( node : ts . Node ) =>
1311 new TranspileError ( `Default Imports are not supported, please use named imports instead!` , node ) ;
1412
15- public static ForbiddenEllipsisDestruction =
16- ( node : ts . Node ) => new TranspileError ( `Ellipsis destruction is not allowed.` , node ) ;
13+ public static ForbiddenEllipsisDestruction = ( node : ts . Node ) =>
14+ new TranspileError ( `Ellipsis destruction is not allowed.` , node ) ;
1715
18- public static ForbiddenForIn =
19- ( node : ts . Node ) => new TranspileError ( `Iterating over arrays with 'for ... in' is not allowed.` , node ) ;
16+ public static ForbiddenForIn = ( node : ts . Node ) =>
17+ new TranspileError ( `Iterating over arrays with 'for ... in' is not allowed.` , node ) ;
2018
2119 public static HeterogeneousEnum = ( node : ts . Node ) => new TranspileError (
2220 `Invalid heterogeneous enum. Enums should either specify no member values, ` +
2321 `or specify values (of the same type) for all members.` ,
2422 node ) ;
2523
26- public static InvalidEnumMember =
27- ( node : ts . Node ) => new TranspileError ( `Only numeric or string initializers allowed for enums.` , node ) ;
28-
2924 public static InvalidDecoratorArgumentNumber = ( name : string , got : number , expected : number , node : ts . Node ) =>
3025 new TranspileError ( `${ name } expects ${ expected } argument(s) but got ${ got } .` , node ) ;
3126
@@ -44,6 +39,9 @@ export class TSTLErrors {
4439 public static InvalidInstanceOfExtension = ( node : ts . Node ) =>
4540 new TranspileError ( `Cannot use instanceof on classes with decorator '@extension' or '@metaExtension'.` , node ) ;
4641
42+ public static InvalidJsonFileContent = ( node : ts . Node ) =>
43+ new TranspileError ( "Invalid JSON file content" , node ) ;
44+
4745 public static InvalidPropertyCall = ( node : ts . Node ) =>
4846 new TranspileError ( `Tried to transpile a non-property call as property call.` , node ) ;
4947
@@ -56,32 +54,30 @@ export class TSTLErrors {
5654 public static KeywordIdentifier = ( node : ts . Identifier ) =>
5755 new TranspileError ( `Cannot use Lua keyword ${ node . escapedText } as identifier.` , node ) ;
5856
59- public static MissingClassName =
60- ( node : ts . Node ) => new TranspileError ( `Class declarations must have a name.` , node ) ;
57+ public static MissingClassName = ( node : ts . Node ) =>
58+ new TranspileError ( `Class declarations must have a name.` , node ) ;
6159
6260 public static MissingMetaExtension = ( node : ts . Node ) =>
63- new TranspileError ( `!MetaExtension requires the extension of the metatable class.` , node ) ;
61+ new TranspileError ( `@metaExtension requires the extension of the metatable class.` , node ) ;
62+
63+ public static UnsupportedDefaultExport = ( node : ts . Node ) =>
64+ new TranspileError ( `Default exports are not supported.` , node ) ;
6465
65- public static UnsupportedImportType = ( node : ts . Node ) => new TranspileError ( `Unsupported import type.` , node ) ;
66+ public static UnsupportedImportType = ( node : ts . Node ) =>
67+ new TranspileError ( `Unsupported import type.` , node ) ;
6668
67- public static UnsupportedKind =
68- ( description : string , kind : ts . SyntaxKind , node : ts . Node ) => {
69+ public static UnsupportedKind = ( description : string , kind : ts . SyntaxKind , node : ts . Node ) =>
70+ {
6971 const kindName = tsHelper . enumName ( kind , ts . SyntaxKind ) ;
7072 return new TranspileError ( `Unsupported ${ description } kind: ${ kindName } ` , node ) ;
71- }
73+ } ;
7274
7375 public static UnsupportedProperty = ( parentName : string , property : string , node : ts . Node ) =>
7476 new TranspileError ( `Unsupported property on ${ parentName } : ${ property } ` , node ) ;
7577
7678 public static UnsupportedForTarget = ( functionality : string , version : string , node : ts . Node ) =>
7779 new TranspileError ( `${ functionality } is/are not supported for target Lua ${ version } .` , node ) ;
7880
79- public static UnsupportedObjectLiteralElement = ( elementKind : ts . SyntaxKind , node : ts . Node ) =>
80- new TranspileError ( `Unsupported object literal element: ${ elementKind } .` , node ) ;
81-
82- public static UnsupportedUnionAccessor = ( node : ts . Node ) =>
83- new TranspileError ( `Unsupported mixed union of accessor and non-accessor types for the same property.` , node ) ;
84-
8581 public static UnsupportedFunctionConversion = ( node : ts . Node , name ?: string ) => {
8682 if ( name ) {
8783 return new TranspileError (
@@ -148,6 +144,4 @@ export class TSTLErrors {
148144 node
149145 ) ;
150146 }
151-
152- public static InvalidJsonFileContent = ( node : ts . Node ) => new TranspileError ( "Invalid JSON file content" , node ) ;
153147}
0 commit comments