Skip to content

Commit 91f87aa

Browse files
committed
fix: include types in dist
1 parent 43530da commit 91f87aa

File tree

3 files changed

+56
-642
lines changed

3 files changed

+56
-642
lines changed

package.json

Lines changed: 15 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,19 @@
1212
"license": "MIT",
1313
"scripts": {
1414
"tdd": "jest --watch",
15-
"test": "npm run lint && jest",
15+
"test": "npm run test:types && npm run lint && jest",
1616
"testonly": "jest",
17+
"test:types": "dtslint types",
1718
"build:es": "babel src -d lib/es --env-name esm --ignore **/__tests__ ",
18-
"build:lib": "babel src -d lib --ignore **/__tests__ --delete-dir-on-start ",
19-
"build": "npm run build:lib && npm run build:es",
19+
"build:lib":
20+
"babel src -d lib --ignore **/__tests__ --delete-dir-on-start ",
21+
"build":
22+
"npm run build:lib && npm run build:es && cpy types/index.d.ts lib/types",
2023
"prepublishOnly": "yarn run build",
21-
"lint": "eslint . && prettier --list-different --ignore-path .eslintignore '**/*.{json,css,md}'",
22-
"format": "eslint . --fix && prettier --write --ignore-path .eslintignore '**/*.{json,css,md}'",
24+
"lint":
25+
"eslint . && prettier --list-different --ignore-path .eslintignore '**/*.{json,css,md}'",
26+
"format":
27+
"eslint . --fix && prettier --write --ignore-path .eslintignore '**/*.{json,css,md}'",
2328
"precommit": "lint-staged"
2429
},
2530
"publishConfig": {
@@ -31,28 +36,19 @@
3136
"trailingComma": "all"
3237
},
3338
"lint-staged": {
34-
"*.js": [
35-
"eslint --fix",
36-
"git add"
37-
],
39+
"*.js": ["eslint --fix", "git add"],
3840
"*.{json,css,md}": [
3941
"prettier --write --ignore-path .eslintignore",
4042
"git add"
4143
]
4244
},
4345
"jest": {
44-
"roots": [
45-
"<rootDir>/test"
46-
],
46+
"roots": ["<rootDir>/test"],
4747
"testEnvironment": "jsdom",
48-
"setupFiles": [
49-
"<rootDir>/test/index.js"
50-
]
48+
"setupFiles": ["<rootDir>/test/index.js"]
5149
},
5250
"release": {
53-
"extends": [
54-
"@4c/semantic-release-config"
55-
],
51+
"extends": ["@4c/semantic-release-config"],
5652
"pkgRoot": "lib"
5753
},
5854
"devDependencies": {
@@ -65,6 +61,7 @@
6561
"babel-eslint": "^8.2.1",
6662
"babel-jest": "^22.4.3",
6763
"codecov": "^3.0.2",
64+
"cpy-cli": "^2.0.0",
6865
"dtslint": "^0.3.0",
6966
"enzyme": "^3.7.0",
7067
"enzyme-adapter-react-16": "^1.6.0",

types/index.d.ts

Lines changed: 4 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// TypeScript Version: 3.0
2+
13
declare module 'react-context-toolbox/forwardRef' {
24
import * as React from 'react';
35

@@ -37,24 +39,12 @@ declare module 'react-context-toolbox/mapContextToProps' {
3739

3840
// Single Context
3941
function mapContextToProps<TComponent, TContext, TContextProps, TOwnProps>(
40-
context: React.Context<TContext>,
41-
mapToProps: (ctxValue: TContext, props: TOwnProps) => TContextProps,
42-
Component: TComponent,
43-
): ContextInjectedComponent<TComponent, TContextProps, TOwnProps>;
44-
function mapContextToProps<TContext, TContextProps, TOwnProps>(
45-
context: React.Context<TContext>,
46-
mapToProps: (ctxValue: TContext, props: TOwnProps) => TContextProps,
47-
): <TComponent>(
48-
component: TComponent,
49-
) => ContextInjectedComponent<TComponent, TContextProps, TOwnProps>;
50-
51-
function mapContextToProps<TComponent, TContext, TContextProps, TOwnProps>(
52-
context: [React.Context<TContext>],
42+
context: React.Context<TContext> | [React.Context<TContext>],
5343
mapToProps: (ctxValue: TContext, props: TOwnProps) => TContextProps,
5444
Component: TComponent,
5545
): ContextInjectedComponent<TComponent, TContextProps, TOwnProps>;
5646
function mapContextToProps<TContext, TContextProps, TOwnProps>(
57-
context: [React.Context<TContext>],
47+
context: React.Context<TContext> | [React.Context<TContext>],
5848
mapToProps: (ctxValue: TContext, props: TOwnProps) => TContextProps,
5949
): <TComponent>(
6050
component: TComponent,

0 commit comments

Comments
 (0)