Ever since learning about it, I have always thought that generic type is awesome. But now I know that it can be even more awesome!
With generic, a single type can be reused with a variety of other types. Think of
Promise, it can resolve to just about anything. For example, in one case it would resolve a string, while another case expect it to resolve a boolean. As
Promise type is a generic, we can assert the resolved value by passing the type into its generic, like so
Alright, enough of the basic. What if you…
I am pretty pissed right now as I just spent about one and a half hours hunting down the exact place a value was defined in a Vue 2 app I am maintaining. Needless to say, it was very unpleasant.
I was trying to refactor the code, extracting out a component from a page to be reusable. As I was moving the code around, the console logged an error:
[Vue warn]: Invalid prop: type check failed for prop "myProp". Expected String with value "undefined", got Undefined
The code shows the expected value seems to be coming from a computed value…
I am setting my goals for 2021, many of which are intentionally ambitious to ensure I work my ass off to achieve them.
Form is ubiquitous in apps. So there is a high chance that you will hit this problem in your first encounter with Flutter.
Say you were testing your pixel-perfect designed form on your test device. You hit the input field, the device’s keyboard was brought up and it covered some of your screen’s contents. You saw a little warning about bottom overflow. You checked your terminal and it printed:
Regardless of the warning, your UI seems to still work, kind of. You noticed that scrolling did not work. So, you googled the problem and found an answer on SO.
I was experimenting with a factory that build an instance of a class, which is passed as a parameter of the factory method. However, TypeScript kept throwing an error as I type the parameter with an interface.
The error thrown was “Type ‘Messenger’ has no construct signatures”.