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

error TS2665: Invalid module name in augmentation #4

Closed
dsebastien opened this Issue Mar 29, 2018 · 8 comments

Comments

Projects
None yet
7 participants
@dsebastien

dsebastien commented Mar 29, 2018

I stumbled upon this issue while trying the hello world tutorial for Apollo with TypeScript: node_modules/apollo-cache-control/lib/index.d.ts(20,16): error TS2665: Invalid module name in augmentation. Module 'graphql/type/definition' resolves to an untyped module at 'C:/dev/wks/bedeals-mvp/functions/node_modules/graphql/type/definition.js', which cannot be augmented..

Did you already see this before?

I'm apparently using apollo-cache-control 0.1.0 through apollo-server-express. I also have graphql-tools 2.23.1.

@apollo-bot apollo-bot bot added the blocking label Mar 29, 2018

@cbacken

This comment has been minimized.

cbacken commented Mar 30, 2018

Exact same issue here as well.

Typescript Version 2.8.1.
apollo-server-express: 1.3.4
graphql-tools: 2.23.1

@dsebastien

This comment has been minimized.

dsebastien commented Mar 30, 2018

I think this issue can be closed for my case; as I've explained in apollographql/apollo-server#927, my problem was caused by incorrect imports for apollo-server-express.

@tsukhu

This comment has been minimized.

tsukhu commented Apr 27, 2018

I did try what @dsebastien mentioned but still got the same compilation error .. So reverted back to the version which was working for the nxplorerjs project (ERS-HCL/nxplorerjs-microservice-starter#112) . I guess it is a combination of multiple libraries including graphql which is causing it.

@whatupdave

This comment has been minimized.

whatupdave commented May 3, 2018

I fixed it by installing the types for graphql

npm i --save-dev @types/graphql
@rgoyardgop

This comment has been minimized.

rgoyardgop commented Dec 5, 2018

Hi,

We currently experience the same issue :

/../node_modules/apollo-cache-control/dist/index.d.ts:22:16 - error TS2665: Invalid module name in augmentation. Module 'graphql/type/definition' resolves to an untyped module at '.../node_modules/graphql/type/definition.js', which cannot be augmented.

22 declare module 'graphql/type/definition' {

Typescript Version 3.2.1
apollo-server-express: 2.2.6
graphql: 14.0.2
graphql-tools: N/A
@types/graphql: 14.0.3

here is our tsconfig.json :

{
    "compilerOptions": {
        "outDir": "./build/",
        "module": "commonjs",
        "target": "es6",
        "experimentalDecorators": true,
        "sourceMap": true,
        "allowSyntheticDefaultImports": true,
        "declaration": false,
        "emitDecoratorMetadata": true,
        "moduleResolution": "node",
        "removeComments": false,
        "strict": false,
        "baseUrl": ".",
        "lib": [
            "dom",
            "es2017",
            "esnext.asynciterable"
        ],
        "typeRoots": ["node_modules/@types"]
    },
    "include": [
        "./src/**/*.ts"
    ],
    "exclude": [
        "./node_modules",
        "./data/",
        "./src/**/test/*.test.ts",
        "./test/"
    ]
}

If have any ideas would appreciate ...

Regards

Rémi

@brianalois

This comment has been minimized.

brianalois commented Dec 6, 2018

Experiencing the same issue as above

@martijnwalraven

This comment has been minimized.

Contributor

martijnwalraven commented Dec 7, 2018

@rgoyardgop @brianalois Can you check if there's a stray version of @types/graphql lingering anywhere in your node_modules? It seems TypeScript isn't picking up the right one.

@rgoyardgop

This comment has been minimized.

rgoyardgop commented Dec 10, 2018

Hi for me the problem was due to misconfiguration of my lerna / yarn workspaces repository. And because typescript, if there is some @types/* forlders in the forlder tree (parents included), will try to compile them even if they are not used in the project. Sorry for the bad reporting

@martijnwalraven thanks for your time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment