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.

Using getters for some functionality?

See original GitHub issue
// Before: `.number()`, `.optional()` etc. as methods
const union = z.union([z.number(), z.boolean()]);
const optionalString = z.string().optional();

// After: `.number()`, `.optional()` etc. as getters
const union = z.union([z.number, z.boolean]);
const optionalString = z.string.optional;

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
colinhackscommented, Jun 3, 2020

Yep, that’s right. 👍

1reaction
colinhackscommented, Jun 2, 2020

You bet - thanks for the suggestion! 🤙

Read more comments on GitHub >

github_iconTop Results From Across the Web

Getters and Setters in Java Explained - freeCodeCamp
Getters and setters are used to protect your data, particularly when creating classes. For each instance variable, a getter method returns ...
Read more >
getter - JavaScript - MDN Web Docs - Mozilla
Getters give you a way to define a property of an object, but they do not calculate the property's value until it is...
Read more >
Getter and Setter in Java - GeeksforGeeks
Getter returns the value (accessors), it returns the value of data type int, String, double, float, etc. For the program's convenience, getter ......
Read more >
Property getters and setters - The Modern JavaScript Tutorial
Accessor properties are represented by “getter” and “setter” methods. In an object literal they are denoted by get and set :.
Read more >
9.9. Access Functions: Getters and Setters
Accessor or getter functions allow clients to get the value saved in one of a supplier object's member variables. Getter functions are typically...
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