unction doSomething(macguffin: any) {
        //todo: implement doSomething
    }
}

export class MyCollection {
    public static doSomething(macguffin: any) {
        //todo: implement doSomething
    }
}

A:

It's probably best to use modules instead of namespaces or static class methods. From the TypeScript official documentation page on namespaces and modules:

Namespaces are simply named JavaScript objects in the global namespace. [...] Just like all global namespace pollution, it can be hard to identify component dependencies, especially in a large application.
[...]
Modules provide for better code reuse, stronger isolation and better tooling support for bundling.
[...]
Starting with ECMAScript 2015, modules are native part of the language, and should be supported by all compliant engine implementations. Thus, for new projects modules would be the recommended code organization mechanism.



Q:

C#: How does the static object.Equals check for equality?

Say you have two different classes where each have their own implementation of Equals; which one is used? What if only one of them have one? Or none of them? Are any of the following lines equivalent?
object .Equals( first, second )
first .Equals( second )
second .Equals( first )

I'm guessing that the first two might be equivalent, but I don't really have a clue.
What does it really do?

A:

Basically it does three things:

Check for reference equality (return true if so)
Check for reference nullity (return false if either value is null; by now the null == null case has been handled)
Check for value equality with first.Equals(second)

The ordering shouldn't matter if both values have well-behaved equality implementations, as equality should be implemented such that x.Equals(y) implies y.Equals(x). However, the offline documentation I've got installed does state that first.Equals(second) (or objA.equals(objB) to use the real parameter naming) is specified. The online documentation doesn't mention this, interestingly enough.
Just to make all of this concrete,