Inversifyjs: Typings of inversify-logger-middleware linked incorrectly

Created on 12 Sep 2016  路  11Comments  路  Source: inversify/InversifyJS

Typings of inversify-logger-middleware linked incorrectly

Expected Behavior

Installing the npm package inversify-logger-middleware should also include the typings definitions automatically. However, VS Code for example does not find the module.

Possible Solution

I think it is because package.json of the module references to the wrong d.ts-file:
"typings": "./dts/inversify.d.ts" instead of "typings": "./dts/index.d.ts"

bug

All 11 comments

Ups, my mistake. Sorry for that.
Thanks for reporting.

Can confirm that an index.d.ts is created and not an inversify.d.ts. When you change it locally, does it work then?

Yes, this was my workaround locally :-)

Hi guys I just released [email protected] it should fix your issue

Can confirm this bug in another project also. Will create a PR to fix both projects :)

I have also released [email protected] I think that's all so I'm closing this issue.

@remojansen in inversify-express-utils is the same problem.

@lholznagel thanks for letting me know! I'm at work now. I have done the changes but I won't be able to release it until this evening :cry:

I just released [email protected]

I'm getting a Cannot find name 'Controller'. when doing this:

import { inject, injectable } from 'inversify'
import { Controller, Get } from 'inversify-express-utils'

@Controller('/foo')
@injectable()
export class FooController implements Controller  {
}

My tsconfig.json:

  "compilerOptions": {
    "target": "es2015",
    "lib": ["es6"],
    "types": ["reflect-metadata"],
    "module": "commonjs",
    "moduleResolution": "node",
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "allowSyntheticDefaultImports": true,
    "noImplicitAny": true
  },

Now I might be mistaken, but I'm wondering how does the following code in decorators.d.ts

import interfaces from "./interfaces";
export declare function Controller(path: string, ...middleware: express.RequestHandler[]): (target: any) => void;
export declare function All(path: string, ...middleware: express.RequestHandler[]): interfaces.HandlerDecorator;
export declare function Get(path: string, ...middleware: express.RequestHandler[]): interfaces.HandlerDecorator;
export declare function Post(path: string, ...middleware: express.RequestHandler[]): interfaces.HandlerDecorator;
export declare function Put(path: string, ...middleware: express.RequestHandler[]): interfaces.HandlerDecorator;
export declare function Patch(path: string, ...middleware: express.RequestHandler[]): interfaces.HandlerDecorator;
export declare function Head(path: string, ...middleware: express.RequestHandler[]): interfaces.HandlerDecorator;
export declare function Delete(path: string, ...middleware: express.RequestHandler[]): interfaces.HandlerDecorator;
export declare function Method(method: string, path: string, ...middleware: express.RequestHandler[]): interfaces.HandlerDecorator;

export the Controller interface. It's importing the interfaces for using them when exporting the decorators, but is not exporting the interface itself. Right?

Hey, I think it matches this issue #371

Thanks, I'll continue on that thread!

Was this page helpful?
0 / 5 - 0 ratings