question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"design:paramnames" metadata key

See original GitHub issue

From https://github.com/Microsoft/TypeScript/pull/2589

A few notes on metadata:

  • Type metadata uses the metadata key “design:type”.
  • Parameter type metadata uses the metadata key “design:paramtypes”.
  • Return type metadata uses the metadata key “design:returntype”.

Can you please add support for a "design:paramnames" metadata key? It would return the design-time names of the arguments of a function

I can convert a function to string at runtime using Function.prototype.toString() and then use a couple of Regex to get the parameter names:

STRIP_COMMENTS = /((\/\/.*$)|(\/\*[\s\S]*?\*\/))/mg;
ARGUMENT_NAMES = /([^\s,]+)/g;

But when a minifier/compressor is used the param names become "a", "b"

I would like to have a way to access the design-time names of the arguments of a function at run-time even after compression.

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:7
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
raymondfengcommented, Dec 19, 2017

+1. At LoopBack, we introduce decorators to annotate method parameters to describe how to map methods to REST APIs. It will be great that we can infer parameter types/names from the design time metadata. For example:

@returnValue()
async createOrder(@param() order: Order): Promise<Order> {
  // ...
}

We would like to know:
- The parameter name ('order') N/A today
- The parameter type (Order) (It's already supported, but not for array item types)
- The return type (Promise) but we care more about `Promise<Order>`
0reactions
nodkzcommented, Apr 9, 2019
Read more comments on GitHub >

github_iconTop Results From Across the Web

Class Metadata.Key<T> - gRPC on GitHub
Key for metadata entries. Allows for parsing and serialization of metadata. Valid characters in key names. Only the following ASCII characters are allowed ......
Read more >
How to use of method in io.grpc.Metadata$Key - Java - Tabnine
Entry<String, String> entry : headers.entrySet()) { headersAsMetadataBuilder.put( Metadata.Key.of(entry.getKey(), Metadata.ASCII_STRING_MARSHALLER), entry.
Read more >
Configuration Metadata - Spring
Keys are logger names, and values correspond to the standard log levels or any custom level. As Spring Boot defines a few logger...
Read more >
Configuring the Metadata Schema - DAMsuccess by Webdam
Metadata is the information used to describe an asset and the primary driver of search. It not only enhances searchability, but can also...
Read more >
The 14 Best Metadata Management Tools for 2022
Solutions Review has compiled this list of the best Metadata ... and maintain key business terms and link them to physical data assets, ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found