chore: Nx 15.6, jest latest and TypeScript 4.9 (#10191)

This commit is contained in:
Nathan Walker
2023-01-30 19:17:49 -08:00
committed by GitHub
parent 50dec8c151
commit 497b2d737e
11 changed files with 59 additions and 77 deletions

View File

@@ -102,25 +102,22 @@ const createComponentInstance = profile('createComponentInstance', (elementName:
return { instance, instanceModule };
});
const getComponentModuleExports = profile(
'getComponentModuleExports',
(instance: View, moduleExports: Object, attributes: Object): Object => {
if (attributes) {
const codeFileAttribute = attributes[CODE_FILE] || attributes[IMPORT];
if (codeFileAttribute) {
const resolvedCodeFileModule = resolveModuleName(sanitizeModuleName(codeFileAttribute), '');
if (resolvedCodeFileModule) {
moduleExports = global.loadModule(resolvedCodeFileModule, true);
(<any>instance).exports = moduleExports;
} else {
throw new Error(`Code file with path "${codeFileAttribute}" cannot be found! Looking for webpack module with name "${resolvedCodeFileModule}"`);
}
const getComponentModuleExports = profile('getComponentModuleExports', (instance: View, moduleExports: Object, attributes: Object): Object => {
if (attributes) {
const codeFileAttribute = attributes[CODE_FILE] || attributes[IMPORT];
if (codeFileAttribute) {
const resolvedCodeFileModule = resolveModuleName(sanitizeModuleName(codeFileAttribute), '');
if (resolvedCodeFileModule) {
moduleExports = global.loadModule(resolvedCodeFileModule, true);
(<any>instance).exports = moduleExports;
} else {
throw new Error(`Code file with path "${codeFileAttribute}" cannot be found! Looking for webpack module with name "${resolvedCodeFileModule}"`);
}
}
return moduleExports;
}
);
return moduleExports;
});
const applyComponentCss = profile('applyComponentCss', (instance: View, moduleName: string, attributes: Object) => {
let cssApplied = false;
@@ -249,5 +246,5 @@ function isBinding(value: any): boolean {
// For example, ListView.itemTemplateSelector
const KNOWN_FUNCTIONS = 'knownFunctions';
function isKnownFunction(name: string, instance: View): boolean {
return instance.constructor && KNOWN_FUNCTIONS in instance.constructor && instance.constructor[KNOWN_FUNCTIONS].indexOf(name) !== -1;
return instance.constructor && KNOWN_FUNCTIONS in instance.constructor && (instance.constructor[KNOWN_FUNCTIONS] as string).indexOf(name) !== -1;
}

View File

@@ -243,7 +243,7 @@ export class Property<T extends ViewBase, U> implements TypedPropertyDescriptor<
}
}
const oldValue = key in this ? this[key] : defaultValue;
const oldValue = <U>(key in this ? this[key] : defaultValue);
const changed: boolean = equalityComparer ? !equalityComparer(oldValue, value) : oldValue !== value;
if (wrapped || changed) {
@@ -310,11 +310,11 @@ export class Property<T extends ViewBase, U> implements TypedPropertyDescriptor<
};
this.get = function (this: T): U {
return key in this ? this[key] : defaultValue;
return <U>(key in this ? this[key] : defaultValue);
};
this.nativeValueChange = function (owner: T, value: U): void {
const oldValue = key in owner ? owner[key] : defaultValue;
const oldValue = <U>(key in owner ? owner[key] : defaultValue);
const changed = equalityComparer ? !equalityComparer(oldValue, value) : oldValue !== value;
if (changed) {
owner[key] = value;
@@ -406,7 +406,7 @@ export class CoercibleProperty<T extends ViewBase, U> extends Property<T, U> imp
};
this.coerce = function (target: T): void {
const originalValue: U = coerceKey in target ? target[coerceKey] : defaultValue;
const originalValue = <U>(coerceKey in target ? target[coerceKey] : defaultValue);
// need that to make coercing but also fire change events
target[propertyName] = originalValue;
};
@@ -662,7 +662,7 @@ export class CssProperty<T extends Style, U> implements CssProperty<T, U> {
value = valueConverter && typeof newValue === 'string' ? valueConverter(newValue) : <U>newValue;
}
const oldValue: U = key in this ? this[key] : defaultValue;
const oldValue = <U>(key in this ? this[key] : defaultValue);
const changed: boolean = equalityComparer ? !equalityComparer(oldValue, value) : oldValue !== value;
if (changed) {
@@ -747,7 +747,7 @@ export class CssProperty<T extends Style, U> implements CssProperty<T, U> {
this[sourceKey] = ValueSource.Css;
}
const oldValue: U = key in this ? this[key] : defaultValue;
const oldValue = <U>(key in this ? this[key] : defaultValue);
const changed: boolean = equalityComparer ? !equalityComparer(oldValue, value) : oldValue !== value;
if (changed) {

View File

@@ -56,18 +56,18 @@
"devDependencies": {
"@angular-devkit/build-angular": "^15.0.1",
"@types/css": "0.0.33",
"@types/jest": "29.1.1",
"@types/jest": "29.4.0",
"@types/loader-utils": "2.0.3",
"@types/lodash.get": "4.4.7",
"@types/micromatch": "4.0.2",
"@types/sax": "1.2.4",
"@types/terser-webpack-plugin": "5.2.0",
"@types/webpack-virtual-modules": "0.1.1",
"jest": "29.1.2",
"jest-matcher-utils": "29.1.2",
"jest": "29.4.1",
"jest-matcher-utils": "29.4.1",
"nativescript-vue-template-compiler": "2.9.3",
"ts-jest": "29.0.3",
"typescript": "4.8.4"
"ts-jest": "29.0.5",
"typescript": "~4.9.5"
},
"peerDependencies": {
"nativescript-vue-template-compiler": "^2.8.1"