@cleanweb/react 1.1.1-beta.12 → 1.1.1-beta.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ type AsyncAllowedEffectCallback = () => Awaitable<IVoidFunction>;
|
|
4
4
|
type UseMountCallbacks = <TInstance extends ComponentInstance<any, any, any>>(instance: TInstance) => void;
|
5
5
|
export declare const useMountCallbacks: UseMountCallbacks;
|
6
6
|
export declare const noOp: () => void;
|
7
|
-
export declare class ComponentInstance<TProps extends o =
|
7
|
+
export declare class ComponentInstance<TProps extends o = {}, TState extends TStateData = WeakEmptyObject, THooks extends o = WeakEmptyObject> extends ComponentLogic<TProps, TState, THooks> {
|
8
8
|
/**
|
9
9
|
* Runs only _before_ first render, i.e before the component instance is mounted.
|
10
10
|
* Useful for logic that is involved in determining what to render.
|
@@ -54,7 +54,7 @@ type InstanceClassParams = ConstructorParameters<typeof ComponentInstance<o, o,
|
|
54
54
|
export interface IComponentInstanceClass<Instance extends ComponentInstance<o, o, o> = ComponentInstance, Params extends InstanceClassParams = InstanceClassParams> extends IComponentLogicClass<Instance, Params> {
|
55
55
|
}
|
56
56
|
type UseInstance = {
|
57
|
-
<Class extends typeof ComponentInstance<HardEmptyObject, o, o>>(Methods: Class & IComponentInstanceClass<InstanceType<Class
|
57
|
+
<Class extends typeof ComponentInstance<HardEmptyObject, o, o>>(Methods: Class & IComponentInstanceClass<InstanceType<Class>>): InstanceType<Class>;
|
58
58
|
<Class extends typeof ComponentInstance<o, o, o>>(Methods: Class & IComponentInstanceClass<InstanceType<Class>>, props: InstanceType<Class>['props']): InstanceType<Class>;
|
59
59
|
};
|
60
60
|
export declare const useInstance: UseInstance;
|
package/build/classy/instance.js
CHANGED
@@ -117,7 +117,7 @@ var useInstance = function () {
|
|
117
117
|
}
|
118
118
|
var Component = args[0], _b = args[1], props = _b === void 0 ? {} : _b;
|
119
119
|
// useHooks.
|
120
|
-
var instance = (0, logic_1.useLogic)(Component, props);
|
120
|
+
var instance = (0, logic_1.useLogic)(Component, props);
|
121
121
|
/**
|
122
122
|
* Argument of type '
|
123
123
|
* [
|
@@ -154,8 +154,16 @@ testing: {
|
|
154
154
|
var A = /** @class */ (function (_super) {
|
155
155
|
__extends(A, _super);
|
156
156
|
function A() {
|
157
|
-
|
157
|
+
var _this = _super !== null && _super.apply(this, arguments) || this;
|
158
|
+
// k = this.props.o
|
159
|
+
_this.a = _this.state['_initialValues_'];
|
160
|
+
return _this;
|
161
|
+
// hard empty has every key
|
162
|
+
// weak empty has no key
|
163
|
+
// weak empty is not assignable to hard empty
|
158
164
|
}
|
159
165
|
return A;
|
160
166
|
}(ComponentInstance));
|
167
|
+
var p = { k: '' };
|
168
|
+
var a = (0, exports.useInstance)(A, { o: '' });
|
161
169
|
}
|
package/build/classy/logic.d.ts
CHANGED
@@ -2,7 +2,7 @@ import type { TCleanState, ExtractCleanStateData, TStateData } from '../base/sta
|
|
2
2
|
export type HardEmpty = HardEmptyObject;
|
3
3
|
export type WeakEmpty = WeakEmptyObject;
|
4
4
|
type o = object;
|
5
|
-
export declare class ComponentLogic<TProps extends o =
|
5
|
+
export declare class ComponentLogic<TProps extends o = {}, TState extends TStateData = WeakEmpty, // WeakEmpty,
|
6
6
|
THooks extends o = WeakEmpty> {
|
7
7
|
state: TCleanState<TState>;
|
8
8
|
props: TProps;
|
@@ -15,7 +15,7 @@ export interface IComponentLogicClass<Instance extends ComponentLogic<o, o, o> =
|
|
15
15
|
getInitialState: (props?: Instance['props']) => ExtractCleanStateData<Instance['state']>;
|
16
16
|
}
|
17
17
|
type UseLogic = {
|
18
|
-
<Class extends typeof ComponentLogic<HardEmptyObject, o, o>>(Methods: Class & IComponentLogicClass<InstanceType<Class
|
18
|
+
<Class extends typeof ComponentLogic<HardEmptyObject, o, o>>(Methods: Class & IComponentLogicClass<InstanceType<Class>>): InstanceType<Class>;
|
19
19
|
<Class extends typeof ComponentLogic<o, o, o>>(Methods: Class & IComponentLogicClass<InstanceType<Class>>, props: InstanceType<Class>['props']): InstanceType<Class>;
|
20
20
|
};
|
21
21
|
declare const useLogic: UseLogic;
|