mpi (@mpidev) header
mpi (@mpidev) profile picture

Experienced full stack developer, indie hacker, creator of @StoryHub_io I post #typescript, #javascript, #java, #functionalprogramming and #tdd stuff

Warsaw, Poland
Joined January 2013
Replying to @WrocTypeScript
Because function parameters are contravariant?
Replying to @TerminusDB
@TerminusDB package has finally arrived! Now it's time to start some serious DB hacking...
1
1
1
Detecting any as a generic type variable in #TypeScript is tricky. You can create a utility type that does it for you. It can help to prevent the accidental spreading of any across the codebase.
2
Append 'as const' at the end of an array, object or literal initialization to have more specific #TypeScript typing.
2
6
You can save a few characters in @typescript by declaring this generic function type alias. Especially useful for functions with many parameters.
1
2
Replying to @typescript
@typescript has a powerful type system that allows deriving types from other types (via type aliases). Sadly, I rarely see this type algebra to be fully utilized in real projects. That's a pity as it can avoid a lot of repetition, prevent silly mistakes and make your IDE shine.
2
2
Did you know that with @typescript you can provide multiple overloaded signatures for a function? This is especially useful for varargs and typed tuples to assure additional type-safety. typescriptlang.org/play/inde…
5
4
Tired of spreading and mapping your state in #redux reducers? Check out how you can make it more declaratively with #lodash: blog.pragmatists.com/lodash-… … #functionalprogramming
1
How to quickly extract some piece of @java code into a new class? Here you have my favourite #refactoring combo (this time) in @intellijidea: Extract Method (Ctrl+Alt+M), Introduce Parameter Object (Shift+Ctrl+Alt+T, 7), Move Method (F6), Inline Method (Ctrl+Alt+N).
2
3
Replying to @hdsdi3g
especially for you, slower version with mouse actions instead of keyboard shortcuts. Actually, the only used shortcut is Shift+Alt+T to invoke generic refactoring menu. Hope you like it more! 🖖
1
My favourite @EclipseJavaIDE #refactoring combo: Extract Method (Shift+Alt+M), Introduce Parameter Object (Shift+Alt+T, P), Move Method (Shift+Alt+V), Change Method Signature (Shift+Alt+C). Allows to quickly extract parts of the code to a new helper class. #EclipseTips
3
49
2
159
Replying to @tiggreen
I like to think about my productivity as a delta of my backlog for a given period of time: p(t0, t1)=(tasks(t0)-tasks(t1))/(t1 - t0). So if you complete 2 features but introduce 4 bugs your productivity will be negative. The key is to keep stuff done grow faster than todo items.
3