You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a specific example to explain why use 'nameof':
functiondecorator(name: string){return ...;}interfaceIInterface{
...
}// then we can decorate something without a literal string// @decorator<IInterface>()
@decorator(nameof(IInterface))classClass{
...
}
I hope the typescript can be written this way instead of the following:
functiondecorator(name: string){return ...;}interfaceIInterface{
...
}// this makes it more prone to errors without type checking
@decorator("IInterface")classClass{
...
}
💻 Use Cases
What do you want to use this for?
Like the example, for decorate with an interface
What shortcomings exist with current approaches?
Without type checking, i dont want to write a literal string
What workarounds are you using in the meantime?
I'm using the literal string, a silly idea i think
The text was updated successfully, but these errors were encountered:
🔍 Search Terms
"nameof" and "1579"
(i know the issue #1579 and i check the issue #394 and #1003)
✅ Viability Checklist
⭐ Suggestion
Use "nameof(ISomeInterface)" instead of "ISomeInterface".
Interface is a type, which means we cannot replace "nameof" by declaring a function:
📃 Motivating Example
This is a specific example to explain why use 'nameof':
I hope the typescript can be written this way instead of the following:
💻 Use Cases
Like the example, for decorate with an interface
Without type checking, i dont want to write a literal string
I'm using the literal string, a silly idea i think
The text was updated successfully, but these errors were encountered: