Definitelytyped: @types/babel__core is missing all @types dependencies

Created on 31 Jul 2018  路  11Comments  路  Source: DefinitelyTyped/DefinitelyTyped

@types/babel__core is missing its dependencies @types/babel__generator, @types/babel__traverse and @types/babel__template.
All of the above types come from a single PR (https://github.com/DefinitelyTyped/DefinitelyTyped/pull/27433).

I expected that dependencies on other DT types were automatically added but they are not.

Do I have to manually add those dependencies since @types/babel__core comes with its own package.json?

Currently I can work arround this by adding the following paths to my tsconfig.json:

{
    "compilerOptions": {
        "baseUrl": "",
        "paths": {
            "@babel/generator": [
                "node_modules/@types/babel__generator"
            ],
            "@babel/template": [
                "node_modules/@types/babel__template"
            ],
            "@babel/traverse": [
                "node_modules/@types/babel__traverse"
            ]
        }
    }
}

Most helpful comment

@mgroenhoff your PR just gets merged! 馃帀

All 11 comments

@andy-ms Can you take a look at this? or tag someone who knows more about this?

esnext/esnext: #149 is waiting on this as well

Same problem here--was able to get around it by manually installing @types/babel__{generator,parser,template,traverse}.

@mgroenhoff I would assume you'd need to include those packages as hard dependencies in babel__core/package.json?

I tried to add the @types/babel__* dependencies to package.json but I got the following error:

Error: In package.json: Don't use a 'package.json' for @types dependencies.
    at checkPackageJsonDependencies (DefinitelyTyped\node_modules\types-publisher\src\lib\definition-parser.ts:166:10)

However the docs at https://github.com/DefinitelyTyped/DefinitelyTyped#i-notice-some-packages-having-a-packagejson-here say that it should be possible.

@andy-ms @RyanCavanaugh @mhegazy Sorry to include you (top types-publisher contributors) but I really need this sorted out. This is a general DT/types-publisher issue and not a babel specific one. I don't know what to do anymore.

I believe you should just be able to add a paths entry to the tsconfig for the types on DT.

Yes. They contain the paths since the beginning otherwise it wouldn't compile. The problem is that it is not automatically generating the corresponding entries in the package.json dependencies.

@weswigham any idea why these paths aren't doing the trick?

@spalger The cause is a bug in types-publisher. This is basically blocked until https://github.com/Microsoft/types-publisher/pull/502 is fixed and I know what to do to trigger a publish for the packages with missing dependencies.

@mgroenhoff your PR just gets merged! 馃帀

Is this issue already fixed?

I have a similar issue on running typedoc + jest.

$ npx typedoc --out docs index.ts

Using TypeScript 3.2.4 from /Users/okuryu/work/tests/tests-20190424/node_modules/typescript/lib
Error: /Users/okuryu/work/tests/tests-20190424/node_modules/@types/babel__core/index.d.ts(12)
 Cannot find module '@babel/types'.
Error: /Users/okuryu/work/tests/tests-20190424/node_modules/@types/babel__core/index.d.ts(13)
 Cannot find module '@babel/parser'.
Error: /Users/okuryu/work/tests/tests-20190424/node_modules/@types/babel__generator/index.d.ts(8)
 Cannot find module '@babel/types'.
Error: /Users/okuryu/work/tests/tests-20190424/node_modules/@types/babel__template/index.d.ts(8)
 Cannot find module '@babel/parser'.
Error: /Users/okuryu/work/tests/tests-20190424/node_modules/@types/babel__template/index.d.ts(9)
 Cannot find module '@babel/types'.
Error: /Users/okuryu/work/tests/tests-20190424/node_modules/@types/babel__traverse/index.d.ts(9)
 Cannot find module '@babel/types'.
Error: /Users/okuryu/work/tests/tests-20190424/node_modules/@types/babel__traverse/index.d.ts(17)
 Property 'scope' of type 'Scope' is not assignable to string index type '(VisitNodeFunction<S, any> & VisitNodeObject<S, any>) | (VisitNodeFunction<S, any> & VisitNodeFunction<S, any>) | (VisitNodeObject<S, any> & VisitNodeObject<S, any>) | (VisitNodeObject<...> & VisitNodeFunction<...>)'.
Error: /Users/okuryu/work/tests/tests-20190424/node_modules/@types/babel__traverse/index.d.ts(18)
 Property 'noScope' of type 'boolean' is not assignable to string index type '(VisitNodeFunction<S, any> & VisitNodeObject<S, any>) | (VisitNodeFunction<S, any> & VisitNodeFunction<S, any>) | (VisitNodeObject<S, any> & VisitNodeObject<S, any>) | (VisitNodeObject<...> & VisitNodeFunction<...>)'.

I think this issue is not jest's bug because it occurs with @types/babel__core. See for more details: https://github.com/facebook/jest/issues/8218

I'm not sure above error is same with this issue, but I had been found a few workaround: https://github.com/facebook/jest/issues/8218#issuecomment-486464992

Was this page helpful?
0 / 5 - 0 ratings