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.

Bug: Add support for optional variables

See original GitHub issue

profile?.username is what’s causing the issue.

        await redis.publish(`user:${profile?.username}.servers`, JSON.stringify(usersServers));
Screen Shot 2020-11-02 at 3 05 28 pm

Removing the ? allows the page to render correctly.

Screen Shot 2020-11-02 at 3 06 18 pm

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
alexcanessacommented, Nov 8, 2020

Oh sorry, I see @OmgImAlexis.

I’m afraid there isn’t much we can do: the highlight is done using codemirror.

There is a newer version that I’ll try to use and get in the next release. It doesn’t seem to update conditional annotations for JS, but we can 🤞 and keep this open until they fix it.

Thanks for raising it.

1reaction
alexcanessacommented, Nov 8, 2020

@OmgImAlexis the support should depend on the TS configuration you use. The problem here is that error isn’t typed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to pass optional parameters while omitting some other ...
Hi @Thomas I totally understand the documentation and know you must add the ? after the parameter in the function definition. But, related...
Read more >
59327 – BASIC: A missing optional argument is treated as a ...
Is a bug because default values are not available and, even worse, the parameters in the function prototype are not available as variables...
Read more >
Can't have paramarrays with optional arguments
Use a ParamArray to define procedures that accept variable-length argument lists. An Optional argument is one that the caller can supply or omit ......
Read more >
Dealing with Optional Parameters in Go | by Peter Malina
The simplest solution for dealing with a small number of variables is to use different functions. This technique uses WithX as a convention...
Read more >
Optional arguments in object variable type definition #19898
Actually there are workarounds for optional arguments in object variables. The tricky part is still on the default value of the variable and ......
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