-
Notifications
You must be signed in to change notification settings - Fork 721
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Importing Kernel interface is difficult #298
Comments
We moved the interfaces under the import { Kernel } from "inversify"; // is Kernel the class or the interface? By doing the following we can solve the naming collision: import { interfaces, Kernel } from "inversify"; // is Kernel the class or the interface?
let kernel: interfaces.Kernel = new Kernel(); |
Hi @Jameskmonger can this be closed? Do you have any ideas about how to improve this without introducing |
I personally think that we should add the The documentation that @mocanu-razvan linked to in #242 was for writing declaration files rather than writing TypeScript. I don't know of any other projects where the interfaces are stored in a separate I would expect to be able to import them like this (and I think lots of others would also):
|
I also like the
And it has recently been added as a TsLint rule. I understand that: import { Kernel, IKernel } from 'inversify';
let kernel: IKernel = new Kernel(); Is nice but is breaking the recommended style guides. The current solution: import { Kernel, interfaces } from 'inversify';
let kernel: interfaces.Kernel = new Kernel(); Requires just one extra word and it allow us to follow the style guide. |
I am happy with the style, I guess it is just odd coming from a .NET perspective. Will close this as not an issue :) |
Thanks! |
Expected Behavior
It should be easier to import the
Kernel
interface. I expected to be able to do:Current Behavior
I have to import the interface like so:
Context
I want to be able to reference the
Kernel
interface as a function argument.The text was updated successfully, but these errors were encountered: