https://stackoverflow.com/questions/18961203/typescript-any-vs-object This has a better description partway down. It contrasts these three:
- var a: any;
- var b: Object;
- var c: {};
Alright, the third of these is basically just an extension of the second, and if you do .Whatever(); off of the second and third items TypeScript's compiler will lose it because there is an interface, if you will (per diegovilar and Retsam), associated with Object that makes it obvious that there is no .Whatever(); In contrast, the first item will allow for .Whatever(); to be called upon it without a compiler error. Any error, should there be one, will happen at runtime. There is no "interface" at the any and the compiler doesn't impose itself.
No comments:
Post a Comment