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.

[proposal] make @prop more concise

See original GitHub issue

Right now you have this code in the example:

@prop(Number)
propA: number;

@prop({
  type: String,
  default: 'default value'
})
propB: string;

However, this could be way way more concise I believe. I would like to propose the following:

Since we’re using typescript, how about inferring the property-type from the type that’s already defined for typescript? And to make it even better, we could also infer the default value from the type definition itself. So that would change the code into the following:

@prop propA: number;

@prop propB: string = "default value";

What do you think? I would really really like it to be this concise.

While we’re at it, I would like to make one more proposition. Props also have a boolean-value for whether or not they are required of course. I would like that to be inferred as well. If no default value has been provided then I think it should be inferred that the prop is required. So in this case propA would be a required prop. And if someone really wants propA to not be required, but also not have a default value, then of course they could define it with null as the default value.

Let me know what you think.

(see here for inspiration)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
kaorun343commented, Jan 20, 2017

I published a new version that includes this new feature.

0reactions
kaorun343commented, Jan 20, 2017

former one.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Write a Business Proposal [Examples + Template]
Briefly summarize the proposal. Touch on your qualifications and why you'd serve as the best choice. To prompt further conversation, confirm ...
Read more >
How to Write a Proposal Letter (With Template and Example)
Include specific information to make it clear.] [In the third paragraph, identify the specific goals you intend to reach and the objectives you ......
Read more >
The Structured Proposal
A structured presentation or proposal offers many benefits. It clarifies your own thought processes, helping you to make a stronger verbal pitch ...
Read more >
How to Write a Business Proposal [a Practical Guide]
On Propfire, we provide business proposal templates with cover ... The more concise and structured, the easier you'll make that happen.
Read more >
How to Write a Project Proposal (Steps & Template Included)
The more eyes on it, the less likely mistakes will make it to the final edition. While you want to keep the proposal...
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