diff --git a/.gitignore b/.gitignore index cc152e1c4f..bf6c14bd88 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ dist lib es coverage +types website/translated_docs website/build/ diff --git a/package.json b/package.json index f9fa58a233..af8b30bf27 100644 --- a/package.json +++ b/package.json @@ -26,16 +26,16 @@ "main": "lib/redux.js", "unpkg": "dist/redux.js", "module": "es/redux.js", - "typings": "./index.d.ts", + "types": "types/index.d.ts", "files": [ "dist", "lib", "es", "src", - "index.d.ts" + "types" ], "scripts": { - "clean": "rimraf lib dist es coverage", + "clean": "rimraf lib dist es coverage types", "format": "prettier --write \"{src,test}/**/*.{js,ts}\" index.d.ts \"**/*.md\"", "format:check": "prettier --list-different \"{src,test}/**/*.{js,ts}\" index.d.ts \"**/*.md\"", "lint": "eslint --ext js,ts src test", @@ -43,9 +43,10 @@ "test": "jest", "test:watch": "npm test -- --watch", "test:cov": "npm test -- --coverage", - "build": "rollup -c", + "build": "npm run build-types && rollup -c", "prepare": "npm run clean && npm run check-types && npm run format:check && npm run lint && npm test", - "check-types": "tsc", + "build-types": "tsc --emitDeclarationOnly", + "check-types": "tsc --noEmit", "examples:lint": "eslint --ext js,ts examples", "examples:test": "cross-env CI=true babel-node examples/testAll.js" }, diff --git a/test/typescript/tsconfig.json b/test/typescript/tsconfig.json index 497fa459db..eb36059da2 100644 --- a/test/typescript/tsconfig.json +++ b/test/typescript/tsconfig.json @@ -4,7 +4,7 @@ "strict": true, "baseUrl": "../..", "paths": { - "redux": ["index.d.ts"] + "redux": ["types/index.d.ts"] } } } diff --git a/tsconfig.json b/tsconfig.json index 0abee9b5c3..1ef2e9f083 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -10,15 +10,17 @@ // "allowJs": true /* Allow javascript files to be compiled. */, // "checkJs": true, /* Report errors in .js files. */ "jsx": "react" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */, - // "declaration": true /* Generates corresponding '.d.ts' file. */, + "declaration": true /* Generates corresponding '.d.ts' file. */, // "declarationMap": true /* Generates a sourcemap for each corresponding '.d.ts' file. */, + "declarationDir": "./types" /* Output directory for generated declaration files. */, + // "emitDeclarationOnly": true /* Only emit ‘.d.ts’ declaration files. */, "sourceMap": true /* Generates corresponding '.map' file. */, // "outFile": "./", /* Concatenate and emit output to single file. */ - // "outDir": "." /* Redirect output structure to the directory. */, + // "outDir": "./types" /* Redirect output structure to the directory. */, // "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */ // "composite": true, /* Enable project compilation */ "removeComments": false /* Do not emit comments to output. */, - "noEmit": true /* Do not emit outputs. */, + // "noEmit": true /* Do not emit outputs. */, // "importHelpers": true, /* Import emit helpers from 'tslib'. */ // "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */ // "isolatedModules": true /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */, @@ -42,9 +44,9 @@ /* Module Resolution Options */ "moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */, "baseUrl": "./" /* Base directory to resolve non-absolute module names. */, - "paths": { - "*": ["*", "types/*"] - } /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */, + // "paths": { + // "*": ["*", "types/*"] + // } /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */, // "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */ // "typeRoots": [], /* List of folders to include type definitions from. */ // "types": [], /* Type declaration files to be included in compilation. */