Wednesday, August 20, 2014

Strongly-typed function callbacks in TypeScript

The question:
In TypeScript I can declare a parameter of a function as a type Function. Is there a "type-safe" way of doing this that I am missing?
My favorite answer: from Drew Noakes:
Here are TypeScript equivalents of some common .NET delegates:
interface Action<T>
    (item: T): void;

interface Func<T,TResult>
    (item: T): TResult;

Renaming a remote branch in Git

I don't quite understand this, but I'll post it here anyway. It comes from StackOverflow user sschuberth.

git push <remote> <remote>/<old_name>:refs/heads/<new_name> :<old_name>

git push origin origin/hotfix/Cant-load-assembly.0:refs/heads/feature/Fix-cant-load-assembly :hotfix/Cant-load-assembly.0