Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Request] - Mention a plugin interaction #117

Open
MrcSnm opened this issue Jul 23, 2021 · 0 comments
Open

[Request] - Mention a plugin interaction #117

MrcSnm opened this issue Jul 23, 2021 · 0 comments

Comments

@MrcSnm
Copy link

MrcSnm commented Jul 23, 2021

Hello!
I've made some plugin for webpack that generates a C-Like macro. So, I've been using this plugin with ts-nameof, and it has a great relationship with this plugin.

For instance, I could define a new macro called _LOG: which would log the variable name with its value

DEFINE(_LOG, (v) =>
{
console.log(nameof(v) + " = ", v);
});
When this function is called anywhere, the output code would be the filename where this function is called, every compile time feature has much to gain from that as it is a simple text replace tool.

//index.ts

let myName = "Test";

_LOG(myName); //myName = "Test"

By using macro functions, no variable name is lost at the function call, which makes a perfect candidate to use together with the nameof plugin
Hope you take a look and we could work in some more interactions for define_macro-loader

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant