@@ -174,10 +174,6 @@ export abstract class LuaTranspiler {
174174 return `"${ this . pathToLuaRequirePath ( relativePath ) } "` ;
175175 }
176176
177- public getRequireKeyword ( ) : string {
178- return "require" ;
179- }
180-
181177 public pathToLuaRequirePath ( filePath : string ) : string {
182178 return filePath . replace ( new RegExp ( "\\\\|\/" , "g" ) , "." ) ;
183179 }
@@ -320,18 +316,18 @@ export abstract class LuaTranspiler {
320316
321317 const imports = node . importClause . namedBindings ;
322318
323- const reqKeyword = this . getRequireKeyword ( ) ;
319+ const requireKeyword = "require" ;
324320
325321 if ( ts . isNamedImports ( imports ) ) {
326322 const fileImportTable = path . basename ( importPathWithoutQuotes ) + this . importCount ;
327323 const resolvedImportPath = this . getImportPath ( importPathWithoutQuotes ) ;
328324
329- let result = `local ${ fileImportTable } = ${ reqKeyword } (${ resolvedImportPath } )\n` ;
325+ let result = `local ${ fileImportTable } = ${ requireKeyword } (${ resolvedImportPath } )\n` ;
330326 this . importCount ++ ;
331327
332328 const filteredElements = imports . elements . filter ( e => {
333- const decs = tsHelper . getCustomDecorators ( this . checker . getTypeAtLocation ( e ) , this . checker ) ;
334- return ! decs . has ( DecoratorKind . Extension ) && ! decs . has ( DecoratorKind . MetaExtension ) ;
329+ const decorators = tsHelper . getCustomDecorators ( this . checker . getTypeAtLocation ( e ) , this . checker ) ;
330+ return ! decorators . has ( DecoratorKind . Extension ) && ! decorators . has ( DecoratorKind . MetaExtension ) ;
335331 } ) ;
336332
337333 if ( filteredElements . length === 0 ) {
@@ -351,7 +347,7 @@ export abstract class LuaTranspiler {
351347 return result ;
352348 } else if ( ts . isNamespaceImport ( imports ) ) {
353349 const resolvedImportPath = this . getImportPath ( importPathWithoutQuotes ) ;
354- return `local ${ this . transpileIdentifier ( imports . name ) } = ${ reqKeyword } (${ resolvedImportPath } )\n` ;
350+ return `local ${ this . transpileIdentifier ( imports . name ) } = ${ requireKeyword } (${ resolvedImportPath } )\n` ;
355351 } else {
356352 throw TSTLErrors . UnsupportedImportType ( imports ) ;
357353 }
0 commit comments