Skip to content

Commit

Permalink
Merge 5a2f8ee into 5d00bb1
Browse files Browse the repository at this point in the history
  • Loading branch information
nhardy committed Mar 29, 2020
2 parents 5d00bb1 + 5a2f8ee commit 497da1f
Show file tree
Hide file tree
Showing 7 changed files with 2,741 additions and 1,342 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/nodejs.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Node CI

on:
on:
pull_request:
branches:
- master
Expand All @@ -15,7 +15,7 @@ jobs:

strategy:
matrix:
node-version: [8.x, 10.x, 12.x]
node-version: [10.x, 12.x, 13.x]

steps:
- uses: actions/checkout@v1
Expand Down
64 changes: 32 additions & 32 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,45 +23,45 @@
"lerna:publish": "lerna publish from-package --cd-version patch --no-git-tag-version --no-push --yes"
},
"devDependencies": {
"@babel/core": "^7.5.5",
"@babel/plugin-proposal-numeric-separator": "^7.2.0",
"@babel/preset-env": "^7.5.5",
"@babel/preset-typescript": "^7.3.3",
"@babel/register": "^7.5.5",
"@betit/rollup-plugin-rename-extensions": "^0.0.5",
"@babel/core": "^7.9.0",
"@babel/plugin-proposal-numeric-separator": "^7.8.3",
"@babel/preset-env": "^7.9.0",
"@babel/preset-typescript": "^7.9.0",
"@babel/register": "^7.9.0",
"@betit/rollup-plugin-rename-extensions": "^0.1.0",
"@types/content-type": "^1.1.3",
"@types/enzyme": "^3.10.3",
"@types/enzyme-adapter-react-16": "^1.0.5",
"@types/jest": "^24.0.18",
"@types/jest-when": "^2.4.1",
"@types/react-dom": "^16.9.0",
"@typescript-eslint/eslint-plugin": "^2.3.3",
"@typescript-eslint/parser": "^2.3.3",
"babel-eslint": "^10.0.3",
"@types/enzyme": "^3.10.5",
"@types/enzyme-adapter-react-16": "^1.0.6",
"@types/jest": "^25.1.4",
"@types/jest-when": "^2.7.0",
"@types/react-dom": "^16.9.5",
"@typescript-eslint/eslint-plugin": "^2.25.0",
"@typescript-eslint/parser": "^2.25.0",
"babel-eslint": "^10.1.0",
"babel-plugin-lodash": "^3.3.4",
"core-js": "^3.2.1",
"enzyme": "^3.10.0",
"enzyme-adapter-react-16": "^1.14.0",
"eslint": "^6.5.1",
"eslint-config-prettier": "^6.4.0",
"eslint-plugin-prettier": "^3.1.1",
"eslint-plugin-react": "^7.16.0",
"jest": "^24.9.0",
"jest-enzyme": "^7.1.0",
"core-js": "^3.6.4",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.2",
"eslint": "^6.8.0",
"eslint-config-prettier": "^6.10.1",
"eslint-plugin-prettier": "^3.1.2",
"eslint-plugin-react": "^7.19.0",
"jest": "^25.2.4",
"jest-enzyme": "^7.1.2",
"jest-sandbox": "^1.1.2",
"jest-when": "^2.6.2",
"jsdom": "^15.1.1",
"jest-when": "^2.7.0",
"jsdom": "^16.2.1",
"jsdom-global": "^3.0.2",
"npm-run-all": "^4.1.5",
"prettier": "^1.18.2",
"react": "^16.9.0",
"react-dom": "^16.9.0",
"rimraf": "^3.0.0",
"rollup": "^1.20.3",
"rollup-plugin-babel": "^4.3.3",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"rimraf": "^3.0.2",
"rollup": "^2.3.0",
"rollup-plugin-babel": "^4.4.0",
"rollup-plugin-node-resolve": "^5.2.0",
"ts-jest": "^24.0.2",
"typescript": "^3.6.2"
"ts-jest": "^25.2.1",
"typescript": "^3.8.3"
},
"jest": {
"preset": "ts-jest",
Expand Down
8 changes: 4 additions & 4 deletions packages/kerosene-ui/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@kablamo/kerosene-ui",
"version": "0.0.14",
"version": "0.0.15",
"repository": {
"type": "git",
"url": "https://github.com/KablamoOSS/kerosene.git",
Expand All @@ -25,11 +25,11 @@
"node": ">= 6"
},
"dependencies": {
"@kablamo/kerosene": "^0.0.13"
"@kablamo/kerosene": "^0.0.15"
},
"devDependencies": {
"react": "^16.9.0",
"react-dom": "^16.9.0"
"react": "^16.13.1",
"react-dom": "^16.13.1"
},
"peerDependencies": {
"react": "^16.8.6",
Expand Down
6 changes: 6 additions & 0 deletions packages/kerosene-ui/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ npm install @kablamo/kerosene-ui

### `<ShowWhen />`

## Utility Types

### `UnwrapComponent<T>`

Unwraps the decorated typings from a decorator-wrapped components to provide the original type of the underlying component. Useful in unit testing when stubbing decorators with the identity function.

## React Hooks

### `useInterval(callback, delay)`
Expand Down
2 changes: 2 additions & 0 deletions packages/kerosene-ui/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ export { default as useRect } from "./hooks/useRect";

export { default as ShowWhen } from "./ShowWhen";

export * from "./types";

export { default as getSafeAreaInsets } from "./utils/getSafeAreaInsets";
import { SafeAreaInsets as _SafeAreaInsets } from "./utils/getSafeAreaInsets";
export type SafeAreaInsets = _SafeAreaInsets;
Expand Down
34 changes: 34 additions & 0 deletions packages/kerosene-ui/src/types/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/**
* Used internally by `UnwrapComponent<T>` to unwrap a single layer decorator-wrapped component
* @private
*/
export type _UnwrapComponent<T> = T extends React.MemoExoticComponent<
infer TMemoComponent
>
? TMemoComponent
: T extends React.LazyExoticComponent<infer TLazyComponent>
? TLazyComponent
: "WrappedComponent" extends keyof T
// @ts-ignore
? T["WrappedComponent"]
: T;

/**
* Unwraps the decorated typings from a decorator-wrapped components to provide the original type of the underlying
* component. Useful in unit testing when stubbing decorators with the identity function.
*
* Note: This will unwrap up to 8 layers of decorators as although TypeScript supports recursive types, it does not
* allow recursive type arguments. If more levels are required, you may use the `_UnwrapComponent<T>` type to unwrap
* a single layer at a time.
*/
export type UnwrapComponent<T> = _UnwrapComponent<
_UnwrapComponent<
_UnwrapComponent<
_UnwrapComponent<
_UnwrapComponent<
_UnwrapComponent<_UnwrapComponent<_UnwrapComponent<T>>>
>
>
>
>
>;

0 comments on commit 497da1f

Please sign in to comment.