Skip to content

Commit aec17d9

Browse files
Revert "fix: quick fix ts"
This reverts commit 36a4d6f.
1 parent e354885 commit aec17d9

File tree

10 files changed

+5
-31
lines changed

10 files changed

+5
-31
lines changed

src/deep-compare.ts

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,7 @@ const deepCompare = (obj1: unknown, obj2: unknown): boolean => {
1818
}
1919

2020
for (const key of keys1) {
21-
if (
22-
!keys2.includes(key) ||
23-
!deepCompare((obj1 as Record<string, unknown>)[key], (obj2 as Record<string, unknown>)[key])
24-
) {
21+
if (!keys2.includes(key) || !deepCompare(obj1[key], obj2[key])) {
2522
return false;
2623
}
2724
}

src/logger.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,6 @@ export interface ILoggerOpts {
1212
manager: Manager;
1313
}
1414

15-
type LogMethod = 'log' | 'error' | 'warn' | 'info';
16-
1715
export interface ILoggerLogOpts {
1816
level: ILoggerOpts['level'];
1917
err?: Error;
@@ -41,7 +39,7 @@ class Logger {
4139
return;
4240
}
4341

44-
let type: LogMethod = 'log';
42+
let type = 'log';
4543

4644
switch (level) {
4745
case 1:

src/make-exported.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ const makeExported = <T extends object>(
1313
},
1414
shouldExtend = true,
1515
): void => {
16-
// @ts-ignore
1716
store[exportedPropName] = { ...(shouldExtend ? store?.[exportedPropName] ?? {} : {}), ...props };
1817
};
1918

@@ -22,22 +21,19 @@ const makeExported = <T extends object>(
2221
* @see IPersistOptions
2322
*/
2423
const isPropExcludedInPersist = (store: TAnyStore): boolean => {
25-
// @ts-ignore
2624
return store?.['libStorageOptions']?.isNotExported || false;
2725
};
2826

2927
/**
3028
* Check if store prop is observable exported
3129
*/
3230
const isPropObservableExported = (store: TAnyStore, prop: string): boolean =>
33-
// @ts-ignore
3431
store?.[exportedPropName]?.[prop] === 'observable';
3532

3633
/**
3734
* Check if store prop is simple exported
3835
*/
3936
const isPropSimpleExported = (store: TAnyStore, prop: string): boolean =>
40-
// @ts-ignore
4137
store?.[exportedPropName]?.[prop] === 'simple';
4238

4339
/**
@@ -48,7 +44,6 @@ const isPropExcludedFromExport = (
4844
prop: string,
4945
withNotExported = false,
5046
): boolean =>
51-
// @ts-ignore
5247
store?.[exportedPropName]?.[prop] === 'excluded' ||
5348
(!withNotExported && isPropExcludedInPersist(store));
5449

src/manager.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,6 @@ class Manager {
201201
return store.libStoreId;
202202
}
203203

204-
// @ts-ignore
205204
let storeId = (store['id'] as string) || (store['name'] as string) || store.constructor.name;
206205

207206
if (store.isGlobal) {
@@ -386,13 +385,10 @@ class Manager {
386385
});
387386

388387
if (isParent) {
389-
// @ts-ignore
390388
res.parentStores[key] = storeInstance;
391389
} else if (storeInstance.isGlobal) {
392-
// @ts-ignore
393390
res.globalStores[key] = storeInstance;
394391
} else {
395-
// @ts-ignore
396392
res.relativeStores[key] = storeInstance;
397393
}
398394

@@ -629,7 +625,6 @@ class Manager {
629625
: this.stores;
630626

631627
for (const [storeId, store] of stores.entries()) {
632-
// @ts-ignore
633628
result[storeId] = this.getStoreState(store, isIncludeExported);
634629
}
635630

@@ -670,7 +665,7 @@ class Manager {
670665
? { [prop]: value }
671666
: {}),
672667
...(isPropObservableExported(store, prop)
673-
? { [prop]: Manager.getObservableProps((store as any)[prop] as TAnyStore) }
668+
? { [prop]: Manager.getObservableProps(store[prop] as TAnyStore) }
674669
: {}),
675670
}),
676671
{},

src/plugins/dev-extension/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import type Manager from '../../manager';
22
import StateListener from './state-listener';
33

44
function connectDevExtension(storeManager: Manager): void {
5-
// @ts-ignore
65
window['__MOBX_STORE_MANAGER__'] = new StateListener(storeManager).subscribe();
76
}
87

src/plugins/dev-extension/state-listener.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,6 @@ class StateListener {
9292
return;
9393
}
9494

95-
// @ts-ignore
9695
this.manager?.['__devOnChange']?.({
9796
event: _.cloneDeep(event),
9897
storesState: this.getStoresState(),

src/plugins/vite/index.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@ function ViteReactMobxManager(): Plugin[] {
1919
idGeneratorPlugin = IdGenerator({ root, isProd: isProduction() });
2020
},
2121
transform(...args) {
22-
// @ts-ignore
2322
return idGeneratorPlugin.transform?.['call'](this, ...args) as TransformResult | undefined;
2423
},
2524
buildEnd(...args) {
26-
// @ts-ignore
2725
idGeneratorPlugin.buildEnd?.['call'](this, ...args);
2826
},
2927
},

src/suspense-query.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,6 @@ class SuspenseQuery {
8585
*/
8686
protected jsonToError(e: Error, values: Record<string, any>): Error {
8787
this.params.errorFields.forEach((name) => {
88-
// @ts-ignore
8988
e[name] = values?.[name];
9089
});
9190

@@ -96,7 +95,6 @@ class SuspenseQuery {
9695
* Throw suspense error
9796
*/
9897
protected throwError(): void {
99-
// @ts-ignore
10098
const value = this.store[this.params.fieldName];
10199

102100
// pass error to error boundary
@@ -114,7 +112,6 @@ class SuspenseQuery {
114112
* - skip run suspense if already completed
115113
*/
116114
protected isComplete(hash: unknown): boolean {
117-
// @ts-ignore
118115
const value = this.store[this.params.fieldName];
119116

120117
// pass error to error boundary
@@ -140,9 +137,7 @@ class SuspenseQuery {
140137
return;
141138
}
142139

143-
// @ts-ignore
144140
if (this.store[fieldName]?.hash !== hash) {
145-
// @ts-ignore
146141
this.store[fieldName] = { hash, done: false };
147142
this.promise = undefined;
148143
}
@@ -152,13 +147,11 @@ class SuspenseQuery {
152147

153148
this.promise.then(
154149
() => {
155-
// @ts-ignore
156150
this.store[fieldName] = { hash, done: true };
157151
},
158152
(e) => {
159153
this.errorJson(e);
160154

161-
// @ts-ignore
162155
this.store[fieldName] = { error: e };
163156
},
164157
);

src/with-stores.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ const withStores = <T extends Record<string, any>, TS extends TMapStores>(
1515
{ customContextId }: IWithStoreOptions = {},
1616
): FC<Omit<T, keyof TS>> => {
1717
const ObservableComponent = observer(Component) as FC;
18-
const manualContextId =
19-
customContextId || (Component as FC<T> & { libStoreContextId?: string })['libStoreContextId'];
18+
const manualContextId = customContextId || (Component['libStoreContextId'] as string);
2019
const componentName = Component.displayName || Component.name;
2120

2221
const Element: FC<Omit<T, keyof TS>> = (props) => {

tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"strictNullChecks": true,
3030
"strict": false,
3131
"pretty": true,
32+
"suppressImplicitAnyIndexErrors": true,
3233
"useDefineForClassFields": true,
3334
"baseUrl": ".",
3435
"paths": {

0 commit comments

Comments
 (0)