Closed k7sleeper closed 8 years ago
Hi @k7sleeper,
If you use import { Logger } from "angular2-logger";
I cannot assure you it won't break in the future. Right now core is the only module, but there will be more, so I don't want to make the above mentioned package import possible. Doing it this way you'll risk to need a refactor later on.
Ah, I understand.
In future it could be possible that more than one root module will be offered by package angular2-logger
. Your're right, if that's the case than typings
does not make sence, but main
also, does it?
So, in my opinion, if you have a main
field in package.json
you should also have a typings
field, or you dont have both.
I don't think there could be more than one root module.
The main
field exists long time before the typings
field, it is not dependant on it.
Well, if you support package loading at runtime (by providing a main
attribute (I appreciate it!)), it's merely consequent to provide the package API information at compile time (set the typings
attribute). Otherwise, package loading support is half-hearted, or rather locks out TypeScript developers from using the offered package loading support. Native JS scripts can load angular2-logger
package today, why not also support TypeScript code to be able to do the same?
With version
0.4.x
package.json
's fieldmain
points to the right file! Thank you very much!So, we have the possibility to write
Yes, I know, that's not the documented way to import this library but that's the purpose of the
main
field. For importing angular2-logger from TypeScript atypings
field is also needed to make the above mentioned package import possible.If you agree, I can send a PR.