3
votes

I am trying to update the TypeScript definition file for react-toolbox found here

I have fixed a number of compile errors and now I have:

ERROR in /myproject/typings/main/definitions/react-toolbox/index.d.ts (1047,8): error TS2664: Invalid module name in augmentation, module 'react-toolbox/lib/app_bar' cannot be found.

relating to the following code in the definition file:

declare module 'react-toolbox' {
    import AppBar from 'react-toolbox/lib/app_bar';

I have installed the definition file using typings and my typings.json file includes:

"dependencies": {
  "react-toolbox": "npm:react-toolbox",

I am using the npm install method because in my tsconfig.json I use exclude and it is not found automatically:

"exclude": [
    "node_modules",
    "typings/browser",
    "typings/browser.d.ts"
],

tsconfig.json uses "node" module resolution

"compilerOptions": {
    "target": "es5",
    "module": "commonjs",
    "moduleResolution": "node",

I'm not sure if I've incorrectly configured the consuming project to be able to find the files in node_modules, or the TypeScript definition file needs to be modified to conform to a standard way of achieving this. I would like to achieve this in the standard way so I can make a pull request and have it updated.

Are all these module declarations even needed, or could it be simplified?

1

1 Answers

0
votes

Looks like this was related to using npm link and webpack. I have unlinked react-toolbox and overwrote the version in the Typings directory with my own and it seems to work.

I have also found this link, which I will try later to see if I can get npm link working again.