|TypeScript: Implicit cast from any to everything?|
The any type is a special type. Where possible,
you should avoid using the any type unless you
want to take advantage of dynamic types.
The any type is a short way of saying...
Treat this variable as if it were compatible
with any other type.
So you can assign it to a string, a number, an
array, an object, a interface with any
structure... anything at all.
So don't think of it as being an
|Is the Function interface missing a new() signature?|
The root cause here is that TypeScript doesn't
actually add a constructor property to objects
that are class instances.
The constructor property you used in extractType
actually exists only because property access uses
the apparent type of the operand, which adds the
members of the global interface Object to the
Technically this code works, but is obviously not
generalizable to all classes
|typescript import alias or variable declaration with commonjs|
Is there any difference between the two, and
when should one be used over the other?
Yes. import also brings it into the type
declaration space. This is only significant for
TypeChecking and not significant in the generated
See http://stackoverflow.com/a/26983363/390330 for