Occasionally there are times where you want to be able to declare a global function which also happens to be TS reserved keyword (e.g. import, delete). But, this means you are unable to call such Lua function, that is without utilizing tstl plugin or a bit of cleverness to workaround such restriction (which is just ugly), the following is an example workaround for invoking global import function:
Playground.
And at some other times, you just feel like renaming Lua call expression/identifier while preserving TS naming (perhaps for better readability, or to remain consistent with the rest of your TS codebase), take this illustrative example:
Input TS:
declare namespace net {
/** @customName get_version */
export function GetVersion(this: void): number;
}
// Usage:
print(net.GetVersion());
Expected transpiled Lua:
The @customName extension would allow us to get around the reserved keyword restriction mentioned earlier.
I propose this extension to be added as part of TSTL language extensions out-of-box, because I think it would be future-proof and more beneficial for the users (as opposed to me implementing this through npm package).
Occasionally there are times where you want to be able to declare a global function which also happens to be TS reserved keyword (e.g.
import,delete). But, this means you are unable to call such Lua function, that is without utilizing tstl plugin or a bit of cleverness to workaround such restriction (which is just ugly), the following is an example workaround for invoking globalimportfunction:Playground.
And at some other times, you just feel like renaming Lua call expression/identifier while preserving TS naming (perhaps for better readability, or to remain consistent with the rest of your TS codebase), take this illustrative example:
Input TS:
Expected transpiled Lua:
The
@customNameextension would allow us to get around the reserved keyword restriction mentioned earlier.I propose this extension to be added as part of TSTL language extensions out-of-box, because I think it would be future-proof and more beneficial for the users (as opposed to me implementing this through npm package).