Skip to content

Commit 4f9187a

Browse files
committed
chore: bump deps
1 parent c424564 commit 4f9187a

20 files changed

+3667
-3881
lines changed

.eslintrc.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,7 @@
44
"extends": [
55
"plugin:react/recommended",
66
"plugin:@typescript-eslint/recommended",
7-
"prettier",
8-
"prettier/@typescript-eslint"
7+
"prettier"
98
],
109
"globals": {
1110
"Atomics": "readonly",
@@ -27,7 +26,7 @@
2726
"@typescript-eslint/no-use-before-define": ["error", { "functions": false, "classes": false }],
2827
"@typescript-eslint/no-explicit-any": "off",
2928
"@typescript-eslint/no-var-requires": "off",
30-
"@typescript-eslint/ban-ts-ignore": "off",
29+
"@typescript-eslint/ban-ts-comment": "off",
3130
"no-console": ["error", { "allow": ["warn", "error"] }]
3231
},
3332
"settings": {

demo/index.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,18 @@ class Count extends Ayanami<State> {
7373
}
7474
}
7575

76+
const InputComponent = React.memo(() => {
77+
const [input, actions] = useAyanami(Count, { selector: (state) => state.input })
78+
79+
return (
80+
<div>
81+
<h3>{input}</h3>
82+
<input value={input} onChange={(e) => actions.changeInput(e.target.value)} />
83+
</div>
84+
)
85+
})
86+
InputComponent.displayName = 'InputComponent'
87+
7688
function CountComponent() {
7789
const [{ count, input }, actions] = useAyanami(Count)
7890
const [{ tips }] = useAyanami(Tips)
@@ -93,16 +105,4 @@ function CountComponent() {
93105
)
94106
}
95107

96-
const InputComponent = React.memo(() => {
97-
const [input, actions] = useAyanami(Count, { selector: (state) => state.input })
98-
99-
return (
100-
<div>
101-
<h3>{input}</h3>
102-
<input value={input} onChange={(e) => actions.changeInput(e.target.value)} />
103-
</div>
104-
)
105-
})
106-
InputComponent.displayName = 'InputComponent'
107-
108108
ReactDOM.render(<CountComponent />, document.querySelector('#app'))

package.json

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -67,15 +67,15 @@
6767
"@types/lodash": "^4.14.136",
6868
"@types/node": "^12.6.9",
6969
"@types/react": "^17.0.3",
70-
"@types/react-dom": "^16.8.5",
71-
"@types/react-test-renderer": "^16.8.3",
70+
"@types/react-dom": "^17.0.2",
71+
"@types/react-test-renderer": "^17.0.1",
7272
"@types/shallowequal": "^1.1.1",
73-
"@typescript-eslint/eslint-plugin": "^2.1.0",
74-
"@typescript-eslint/parser": "^2.0.0",
73+
"@typescript-eslint/eslint-plugin": "^4.18.0",
74+
"@typescript-eslint/parser": "^4.18.0",
7575
"codecov": "^3.5.0",
76-
"eslint": "6.6.0",
77-
"eslint-config-prettier": "^6.0.0",
78-
"eslint-plugin-react": "^7.14.3",
76+
"eslint": "7.22.0",
77+
"eslint-config-prettier": "^8.1.0",
78+
"eslint-plugin-react": "^7.21.5",
7979
"husky": "^4.3.0",
8080
"immer": "^8.0.1",
8181
"jest": "^24.8.0",
@@ -85,21 +85,21 @@
8585
"npm-run-all": "^4.1.5",
8686
"parcel": "^1.12.3",
8787
"prettier": "^2.2.1",
88-
"react": "^16.8.6",
89-
"react-dom": "^16.8.6",
90-
"react-test-renderer": "^16.8.6",
88+
"react": "^17.0.1",
89+
"react-dom": "^17.0.1",
90+
"react-test-renderer": "^17.0.1",
9191
"reflect-metadata": "^0.1.13",
9292
"rxjs": "^6.5.2",
9393
"shx": "^0.3.2",
9494
"ts-jest": "^24.0.2",
95-
"tslib": "^1.10.0",
96-
"typescript": "^3.5.3"
95+
"tslib": "^2.1.0",
96+
"typescript": "^4.2.3"
9797
},
9898
"peerDependencies": {
9999
"@asuka/di": "^0.2.0",
100-
"immer": "^3.2.0",
100+
"immer": "^8.0.1",
101101
"lodash": "^4.17.15",
102-
"react": "^16.8.6",
102+
"react": "^17.0.1",
103103
"reflect-metadata": "^0.1.13",
104104
"rxjs": "^6.5.2"
105105
}

src/connect.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ type ConnectedComponent<P, S, A> = React.FunctionComponent<Omit<P, keyof S | key
88
type ConnectComponent<S, A> = <P>(Component: React.ComponentType<P>) => ConnectedComponent<P, S, A>
99

1010
export interface ComponentConnectedWithAyanami<M extends Ayanami<S>, S> {
11-
(): ConnectComponent<{}, {}>
11+
(): ConnectComponent<Record<string, unknown>, Record<string, unknown>>
1212

13-
<MS>(mapStateToProps: (state: S) => MS): ConnectComponent<MS, {}>
13+
<MS>(mapStateToProps: (state: S) => MS): ConnectComponent<MS, Record<string, unknown>>
1414

1515
<MS, MA>(
1616
mapStateToProps: (state: S) => MS,
@@ -20,7 +20,7 @@ export interface ComponentConnectedWithAyanami<M extends Ayanami<S>, S> {
2020
<MA>(
2121
mapStateToProps: null,
2222
mapActionsToProps: (actions: ActionMethodOfAyanami<M, S>) => MA,
23-
): ConnectComponent<{}, MA>
23+
): ConnectComponent<Record<string, unknown>, MA>
2424
}
2525

2626
export function connectAyanami<M extends Ayanami<S>, S>(

src/core/ayanami.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ export abstract class Ayanami<State> {
4545
}
4646
}
4747

48-
destroy() {
48+
destroy(): void {
4949
destroyIkariFrom(this)
5050
}
5151

src/core/decorators/action-related.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,18 @@ import { Ayanami } from '../ayanami'
33
import { ConstructorOf } from '../types'
44

55
export function createActionDecorator(symbols: ActionSymbols) {
6-
return () => (target: any, propertyKey: string, descriptor: PropertyDescriptor) => {
6+
return () => (
7+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
8+
target: any,
9+
propertyKey: string,
10+
descriptor: PropertyDescriptor,
11+
): PropertyDescriptor => {
712
addActionName(symbols, target.constructor, propertyKey)
813
return descriptor
914
}
1015
}
1116

17+
// eslint-disable-next-line @typescript-eslint/ban-types
1218
function addActionName(symbols: ActionSymbols, constructor: Function, actionName: string) {
1319
const decoratedActionNames = Reflect.getMetadata(symbols.decorator, constructor) || []
1420
Reflect.defineMetadata(symbols.decorator, [...decoratedActionNames, actionName], constructor)
@@ -21,7 +27,7 @@ export function getActionNames<T extends Ayanami<any>>(
2127
return Reflect.getMetadata(symbols.decorator, constructor) || []
2228
}
2329

24-
export function getAllActionNames<T extends Ayanami<any>>(instance: T) {
30+
export function getAllActionNames<T extends Ayanami<any>>(instance: T): (keyof T)[] {
2531
return allActionSymbols.reduce<(keyof T)[]>(
2632
(result, symbols) => [
2733
...result,

src/core/ikari.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,10 @@ export function combineWithIkari<S>(ayanami: Ayanami<S>): Ikari<S> {
5252
} else {
5353
const { effects, reducers, immerReducers, defineActions } = getOriginalFunctions(ayanami)
5454

55-
Object.assign(ayanami, mapValues(defineActions, ({ observable }) => observable))
55+
Object.assign(
56+
ayanami,
57+
mapValues(defineActions, ({ observable }) => observable),
58+
)
5659

5760
return Ikari.createAndBindAt(ayanami, {
5861
nameForLog: ayanami.constructor.name,
@@ -103,6 +106,7 @@ export class Ikari<State> {
103106
// @internal
104107
terminate$ = new Subject<typeof TERMINATE_ACTION | null>()
105108

109+
// eslint-disable-next-line @typescript-eslint/explicit-member-accessibility
106110
constructor(readonly ayanami: Ayanami<State>, private readonly config: Readonly<Config<State>>) {
107111
const [effectActions$, effectActions] = setupEffectActions(
108112
this.config.effects,
@@ -158,7 +162,7 @@ export class Ikari<State> {
158162
)
159163
}
160164

161-
destroy() {
165+
destroy(): void {
162166
this.subscription.unsubscribe()
163167
this.triggerActions = {}
164168
}

src/core/scope/same-scope-decorator.ts

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
export const SameScopeMetadataKey = Symbol('SameScopeInjectionParams')
22

3-
export const SameScope = () => (target: any, _propertyKey: string, parameterIndex: number) => {
3+
export const SameScope = () => (
4+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
5+
target: any,
6+
_propertyKey: string,
7+
parameterIndex: number,
8+
): void => {
49
let sameScopeInjectionParams: boolean[] = []
510
if (Reflect.hasMetadata(SameScopeMetadataKey, target)) {
611
sameScopeInjectionParams = Reflect.getMetadata(SameScopeMetadataKey, target)

src/core/scope/utils.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ function getInstanceFrom<T>(constructor: ConstructorOf<T>, scope: Scope): T | un
7777
return scopeMap && scopeMap.get(scope)
7878
}
7979

80+
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
8081
export function createScopeWithRequest(req: Request, scope: any | undefined) {
8182
if (!scope) {
8283
return req

src/core/types.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ import { Draft } from 'immer'
44
import { Ayanami } from './ayanami'
55

66
// https://stackoverflow.com/questions/55541275/typescript-check-for-the-any-type
7-
type IfAny<T, Y, N> = 0 extends (1 & T) ? Y : N
7+
type IfAny<T, Y, N> = 0 extends 1 & T ? Y : N
88

99
type IsAny<T> = IfAny<T, true, false>
1010

1111
// https://stackoverflow.com/questions/55542332/typescript-conditional-type-with-discriminated-union
1212
type IsVoid<T> = IsAny<T> extends true ? false : [T] extends [void] ? true : false
1313

1414
// using class type to avoid conflict with user defined params
15+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
1516
class ArgumentsType<_Arguments extends any[]> {}
1617

1718
export type ActionMethod<
@@ -43,6 +44,7 @@ export interface ReducerAction<State> {
4344
readonly nextState: State
4445
}
4546

47+
// eslint-disable-next-line @typescript-eslint/ban-types
4648
type UnpackEffectFunctionArguments<T extends Function> = T extends (
4749
...payload: infer Arguments
4850
) => Observable<EffectAction>
@@ -61,6 +63,7 @@ type UnpackEffectPayload<Func, State> = Func extends () => Observable<EffectActi
6163
? UnpackEffectFunctionArguments<Func>
6264
: never
6365

66+
// eslint-disable-next-line @typescript-eslint/ban-types
6467
type UnpackReducerFunctionArguments<T extends Function> = T extends (
6568
state: any,
6669
...payload: infer Arguments

0 commit comments

Comments
 (0)