fix: build

This commit is contained in:
2023-03-14 18:04:29 +01:00
parent 3792a14e90
commit fd740b3091
185 changed files with 21932 additions and 71486 deletions

View File

@@ -15,7 +15,6 @@
*/
import equal = require('fast-deep-equal/es6');
import clone = require('rfdc');
import {Defined, TSOCType} from 'ts-optchain';
import {SCLanguageCode} from './general/i18n';
import {isThing} from './guards';
import {SCClasses} from './meta';
@@ -90,21 +89,15 @@ export class SCThingTranslator {
* Get field value translation recursively
*
* @param data The intermediate object / primitive returned by the Proxys get() method
* @returns an TSOCType<T> object allowing for access to translations or a translated value(s)
* @returns a T object allowing for access to translations or a translated value(s)
*/
private deeptranslate<T>(data?: T): TSOCType<T> {
const proxy = new Proxy(
((defaultValue?: Defined<T>) => (data == undefined ? defaultValue : data)) as TSOCType<T>,
private deeptranslate<T>(data: T): T {
return typeof data === 'object' ? new Proxy(
data as never,
{
get: (target, key) => {
const object: any = target();
return this.deeptranslate(object[key]);
},
get: (target, key) => this.deeptranslate(target[key as never]),
},
);
return proxy;
) as unknown as T : data;
}
/**
@@ -260,12 +253,12 @@ export class SCThingTranslator {
* @param thing Top level object that gets passed through the recursion
* @returns an TSOCType<T> object allowing for access to translations or a translated value(s)
*/
public translatedAccess<T extends SCThing>(thing: T): TSOCType<T> {
public translatedAccess<T extends SCThing>(thing: T): T {
return new Proxy(
((defaultValue?: Defined<T>) => (thing == undefined ? defaultValue : thing)) as TSOCType<T>,
thing,
{
get: (target, key) => {
const object: any = target();
const object: any = target;
if (equal(this.sourceCache.get(thing), thing)) {
const objectTranslatedFromCache = this.cache.get(thing);
if (objectTranslatedFromCache !== undefined) {