Skip to content
This repository was archived by the owner on Dec 1, 2019. It is now read-only.

Module augmentation shows errors that bare typescript doesn't #205

Open
Tragetaschen opened this issue Aug 9, 2016 · 7 comments
Open

Module augmentation shows errors that bare typescript doesn't #205

Tragetaschen opened this issue Aug 9, 2016 · 7 comments

Comments

@Tragetaschen
Copy link

Repro: https://github.com/Tragetaschen/awesome-typescript-loader-module-augmentation

I am trying to temporarily fix an bug in the d3-v4 @types/d3-shape by augmenting the d3-shape module with another member in a local .d.ts file.

Typescript is fine with this (tsc -p .).

Invoking TypeScript through webpack and awesome-typescript-loader on the other hand shows

ERROR in [default] C:\Users\kairu\Source\Repos\awesome-typescript-loader-module-augmentation\main.ts:1:15
Module '"C:/Users/kairu/Source/Repos/awesome-typescript-loader-module-augmentation/node_modules/@types/d3-shape/index"' has no exported member 'curveStepAfter'.

ERROR in [default] d3-fixup.d.ts:1:29
Cannot find module 'd3-shape'.

As you can see, I'm running on Windows. Node is v6.1.0 and npm 3.8.6.

@s-panferov
Copy link
Owner

@Tragetaschen Thanks for the repro example, I'll take a look

@thrandre
Copy link

I'm having a somewhat similar issue with react and react-dom.

ERROR in [default] C:\Projects\Prover-hoved\src\UDIR.Prover.Frontend\node_modules\@types\react-dom\react-dom.server.d.ts:2:30        
Cannot find module 'react'. 

I'm guessing this is the culprit (from @types/react-dom/react-dom.server.d.ts):

declare module "react-dom/server" {
    import { ReactElement } from 'react'; // This should point to typings at @types/react

...
}

No compilation issues when using version prior to 2.0.3 (2.0.2 works like a charm) or when using tsc directly.

My tsconfig.json (for completeness):

{
    "version": "2.0",
    "compilerOptions": {
        "target": "es2015",
        "noImplicitAny": true,
        "jsx": "react",
        "sourceMap": true,
        "moduleResolution": "node",
        "allowSyntheticDefaultImports": true,
        "paths": {
            "common/components/*": ["./common/components/*"]
        },
        "baseUrl": ""
    },
    "awesomeTypescriptLoaderOptions": {
        "useBabel": true,
        "useCache": true
    },
    "exclude": [
        "node_modules"
    ]
}

Thanks!

@s-panferov
Copy link
Owner

@Tragetaschen should be fixed in v2.2.0

@Tragetaschen
Copy link
Author

Hmm, my reproduction still fails on my machine. The errors are reversed, though:

Hash: e2e2cd05bd0594692276
Version: webpack 2.1.0-beta.20
Time: 1250ms
  Asset     Size  Chunks             Chunk Names
main.js  89.2 kB       0  [emitted]  main
    + 51 hidden modules

ERROR in [default] C:\Users\kairu\Source\Repos\awesome-typescript-loader-module-augmentation\d3-fixup.d.ts:1:29
Cannot find module 'd3-shape'.

ERROR in [default] C:\Users\kairu\Source\Repos\awesome-typescript-loader-module-augmentation\main.ts:1:15
Module '"C:/Users/kairu/Source/Repos/awesome-typescript-loader-module-augmentation/node_modules/@types/d3-shape/index"' has no exported member 'curveStepAfter'.

@s-panferov s-panferov reopened this Aug 15, 2016
@s-panferov
Copy link
Owner

It seems that I need to test this on windows.

@T-Hugs
Copy link

T-Hugs commented Aug 18, 2016

I'm running into the exact same issue as @thrandre on 2.1.1.

@krokofant
Copy link

krokofant commented Oct 9, 2016

I'm having the same error as @thrandre on atl 2.2.4 with ts 2.0.3

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants