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.

RFC: Documenting the default value for a parameter

See original GitHub issue

In issue https://github.com/Microsoft/tsdoc/issues/27#issuecomment-473178150 , @sindresorhus asked:

How about documenting default function parameters? What will that look like?

I’ve opened a new issue since I think it’s a separate topic from the @defaultValue tag.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:17
  • Comments:10

github_iconTop GitHub Comments

9reactions
JakeShirleycommented, Nov 16, 2021

Any movement on this? I am new to Typescript and I found it quite odd that I couldn’t put the default values in my .d.ts files. I’d really like for the users of my code to know the default values for these parameters (as we only ship .d.ts files) but there doesn’t seem to be a way to do that.

4reactions
FractalHQcommented, Jul 19, 2022

I strongly agree with @JakeShirley and come across this often. Regarding @octogonz’s comment:

My initial instinct would be to say that TSDoc should not be involved with parameter defaults, because the information is already clearly expressed in the source code.

I use TSDoc so that I don’t have to read soure code to know what a function does.

For example, I really think the hover-info for a function like this should include the important fact that the default is 0.5. Or I should at least have a formal way to add that information, no? This added information is completely invisible (and seemingly useless) in my editor:

Screenshot 2022-07-19 at 11 59 35 AM

Sorry if I’m just missing something here 😅

Read more comments on GitHub >

github_iconTop Results From Across the Web

set multiple default values to RFC - SAP Community
Hemanth,. You can have default values for every single input parameter in your RFC. But for one parameter, you can have only one...
Read more >
With-defaults Capability for NETCONF RFC 6243
Non-configuration data nodes containing the schema default value MUST NOT be reported. ... Retrieval of Default Data This document defines a new parameter, ......
Read more >
RFC 2215: General Characterization Parameters for ...
In practice, it may be appropriate for vendors to choose and document a tolerance ... Default and Service-Specific Values for General Parameters General ......
Read more >
Measurement Protocol Parameter Reference
This document lists all of the parameters for the Measurement Protocol. ... Parameter, Value Type, Default Value, Max Length, Supported Hit Types.
Read more >
PHP RFC: Named Arguments
Named arguments are passed by prefixing the value with the parameter name followed by a colon: callAFunction(paramName: $value);. It is possible ...
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