Currently I am using namespaces to represent Lua globals with functions inside of them- that is okay, but this is not okay:
/** @noSelf */
declare namespace fs {
...
/** Deletes a file or directory. */
function delete(path: string): void // <---- delete is a reserved word that cannot be used here
...
}
This is a problem - the function is named delete but TypeScript does not have the capability to represent this!
Merging is not allowed:

And even without type checking, the transpilation only recognizes the namespace declaration above so it doesn't even work correctly:

My only option is to include the function definition inside the namespace, but since function identifiers cannot be strings there is no way to name the function delete, so there needs to be a way to communicate to TypeScriptToLua that the function on the Lua side is named that way.
The issue? There isn't yet such a feature.
I propose an @luaName annotation, which will allow you to specify a Lua name for the function. This would allow me to name the function something different like _delete and then in the transpilation step it is turned back to delete.
Example:
/** @luaName bar */
declare function foo(x: string): void
foo('Hi!')
would transpile to
Likewise,
/** @noSelf */
declare namespace fs {
/** Deletes a file or directory.
* @luaName delete */
function _delete(path: string): void
}
fs._delete('some path')
would transpile to
Currently I am using namespaces to represent Lua globals with functions inside of them- that is okay, but this is not okay:
This is a problem - the function is named
deletebut TypeScript does not have the capability to represent this!Merging is not allowed:
And even without type checking, the transpilation only recognizes the namespace declaration above so it doesn't even work correctly:
My only option is to include the function definition inside the namespace, but since function identifiers cannot be strings there is no way to name the function
delete, so there needs to be a way to communicate to TypeScriptToLua that the function on the Lua side is named that way.The issue? There isn't yet such a feature.
I propose an
@luaNameannotation, which will allow you to specify a Lua name for the function. This would allow me to name the function something different like_deleteand then in the transpilation step it is turned back todelete.Example:
would transpile to
Likewise,
would transpile to