inversify / InversifyJS

A powerful and lightweight inversion of control container for JavaScript & Node.js apps powered by TypeScript.
http://inversify.io/
MIT License
11.34k stars 719 forks source link

Cannot build due to triple-slash reference in typings #101

Closed mattgrayisok closed 8 years ago

mattgrayisok commented 8 years ago

Expected Behavior

Upon build I receive:

node_modules/inversify/type_definitions/inversify-npm.d.ts(6,1): error TS2654: Exported external package typings file cannot cont ain tripleslash references. Please contact the package author to update the package definition.

Possible Solution

Removing /// <reference path="../typings/browser/ambient/bluebird/bluebird.d.ts" /> from type_definitions/inversify-npm.d.ts solves the problem but then requires an ES6 target for Promises.

Alternatively cd node_modules/inversify && typings install will download BlueBird into the correct directory but the filename is incorrect. It actually results in a file at typings/browser/ambient/bluebird/index.d.ts. Also, installing things in node_modules feels a bit gack.

Context

Relatively new to TypeScript so my understanding of the specifics of the typings and imports methodology is a bit fuzzy, please enlighten me if I'm doing something silly.

Just trying to get inversify up and running for use in a relatively large project.

Your Environment

  "compilerOptions": {
        "module": "commonjs",
        "noImplicitAny": false,
        "removeComments": true,
        "preserveConstEnums": true,
        "sourceMap": true,
        "target": "es6",
        "outDir": "build",
        "moduleResolution": "node",
        "isolatedModules": false,
        "experimentalDecorators": true,
        "emitDecoratorMetadata": true,
        "declaration": false,
        "noLib": false,
        "suppressImplicitAnyIndexErrors": true
    }
remojansen commented 8 years ago

Thanks for reporting. I will fix it as soon as I can, for the moment you should be able to manually point to:

/// <reference path="/node_modules/inversify/type_definitions/inversify.d.ts" />
remojansen commented 8 years ago

Hi @slice-beans I just released 2.0.0-alpha.3 can you please try again. Please note that I have removed the typings field in the package.json because it was causing many problems. You need to reference the following file as described in the new docs:

 /// <reference path="node_modules/inversify/type_definitions/inversify.d.ts" />

Hope it helps :four_leaf_clover:

mattgrayisok commented 8 years ago

Thanks @remojansen. Just tried it out and the typings referencing is working as expected now.

The process I followed this time around was:

Note that includinginversify.d.ts as a file: reference in a typings config results in bluebird not being included for whatever reason and consequently Promise is undefined when target is set to es5. Might be something to look into in the future :+1:

remojansen commented 8 years ago

Thanks for taking a look. I just added the type definitions to DefinitelyTyped. Once the PR has been merged into master you will be able to do:

$ npm install inversify@2.0.0-alpha.3
$ typings install inversify --ambient

I'm closing this issue but please write back if you have more problems.

remojansen commented 8 years ago

The bluebird issue should be fixed now thanks to https://github.com/inversify/InversifyJS/pull/114