Skip to content

Commit 766f934

Browse files
cellogtimdorr
authored andcommitted
fully move away from index.d.ts (#3561)
* fully move away from index.d.ts * build types into the types/ directory * remove autogenerated types dir * ignore auto-generated types * better type building, also clean old definitions * use types instead of typings Co-Authored-By: Jed Mao <[email protected]> * Don't build declaration maps
1 parent 066fa81 commit 766f934

File tree

4 files changed

+16
-12
lines changed

4 files changed

+16
-12
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ dist
55
lib
66
es
77
coverage
8+
types
89

910
website/translated_docs
1011
website/build/

package.json

+6-5
Original file line numberDiff line numberDiff line change
@@ -26,26 +26,27 @@
2626
"main": "lib/redux.js",
2727
"unpkg": "dist/redux.js",
2828
"module": "es/redux.js",
29-
"typings": "./index.d.ts",
29+
"types": "types/index.d.ts",
3030
"files": [
3131
"dist",
3232
"lib",
3333
"es",
3434
"src",
35-
"index.d.ts"
35+
"types"
3636
],
3737
"scripts": {
38-
"clean": "rimraf lib dist es coverage",
38+
"clean": "rimraf lib dist es coverage types",
3939
"format": "prettier --write \"{src,test}/**/*.{js,ts}\" index.d.ts \"**/*.md\"",
4040
"format:check": "prettier --list-different \"{src,test}/**/*.{js,ts}\" index.d.ts \"**/*.md\"",
4141
"lint": "eslint --ext js,ts src test",
4242
"pretest": "npm run build",
4343
"test": "jest",
4444
"test:watch": "npm test -- --watch",
4545
"test:cov": "npm test -- --coverage",
46-
"build": "rollup -c",
46+
"build": "npm run build-types && rollup -c",
4747
"prepare": "npm run clean && npm run check-types && npm run format:check && npm run lint && npm test",
48-
"check-types": "tsc",
48+
"build-types": "tsc --emitDeclarationOnly",
49+
"check-types": "tsc --noEmit",
4950
"examples:lint": "eslint --ext js,ts examples",
5051
"examples:test": "cross-env CI=true babel-node examples/testAll.js"
5152
},

test/typescript/tsconfig.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"strict": true,
55
"baseUrl": "../..",
66
"paths": {
7-
"redux": ["index.d.ts"]
7+
"redux": ["types/index.d.ts"]
88
}
99
}
1010
}

tsconfig.json

+8-6
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,17 @@
1010
// "allowJs": true /* Allow javascript files to be compiled. */,
1111
// "checkJs": true, /* Report errors in .js files. */
1212
"jsx": "react" /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */,
13-
// "declaration": true /* Generates corresponding '.d.ts' file. */,
13+
"declaration": true /* Generates corresponding '.d.ts' file. */,
1414
// "declarationMap": true /* Generates a sourcemap for each corresponding '.d.ts' file. */,
15+
"declarationDir": "./types" /* Output directory for generated declaration files. */,
16+
// "emitDeclarationOnly": true /* Only emit ‘.d.ts’ declaration files. */,
1517
"sourceMap": true /* Generates corresponding '.map' file. */,
1618
// "outFile": "./", /* Concatenate and emit output to single file. */
17-
// "outDir": "." /* Redirect output structure to the directory. */,
19+
// "outDir": "./types" /* Redirect output structure to the directory. */,
1820
// "rootDir": "./", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
1921
// "composite": true, /* Enable project compilation */
2022
"removeComments": false /* Do not emit comments to output. */,
21-
"noEmit": true /* Do not emit outputs. */,
23+
// "noEmit": true /* Do not emit outputs. */,
2224
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
2325
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
2426
// "isolatedModules": true /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */,
@@ -42,9 +44,9 @@
4244
/* Module Resolution Options */
4345
"moduleResolution": "node" /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */,
4446
"baseUrl": "./" /* Base directory to resolve non-absolute module names. */,
45-
"paths": {
46-
"*": ["*", "types/*"]
47-
} /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */,
47+
// "paths": {
48+
// "*": ["*", "types/*"]
49+
// } /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */,
4850
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
4951
// "typeRoots": [], /* List of folders to include type definitions from. */
5052
// "types": [], /* Type declaration files to be included in compilation. */

0 commit comments

Comments
 (0)