Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion src/core/middleware/data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@ function createResourceOptions(
if (options.query) {
let query: ResourceQuery[] = [];
if (isDataTransformProperties(properties)) {
query = transformQuery(options.query, properties.transform);
const newProperties: DataTransformProperties<any> = properties;
query = transformQuery(options.query, newProperties.transform);
} else {
query = transformQuery(options.query);
}
Expand Down
2 changes: 1 addition & 1 deletion src/core/middleware/focus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { FocusProperties } from '../interfaces';

export { FocusProperties } from '../interfaces';

interface FocusState {
export interface FocusState {
current: number;
}

Expand Down
10 changes: 5 additions & 5 deletions src/core/middleware/theme.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,13 +105,13 @@ export const theme = factory(

return {
classes<T extends ClassNames>(css: T): T {
let theme = icache.get<T>(css);
if (theme) {
return theme;
const cachedTheme = icache.get<T>(css);
if (cachedTheme) {
return cachedTheme;
}
const { [THEME_KEY]: key, ...classes } = css;
themeKeys.add(key);
theme = classes as T;
let theme = classes as ClassNames;
let { theme: currentTheme, classes: currentClasses } = properties();

if (currentTheme && isThemeWithVariant(currentTheme)) {
Expand All @@ -133,7 +133,7 @@ export const theme = factory(
}
}
icache.set(css, theme, false);
return theme;
return theme as T;
},
variant() {
const { theme } = properties();
Expand Down
2 changes: 1 addition & 1 deletion src/shim/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ if (!has('es6-array')) {
return this;
};

type Predicate = (this: void, value: any, index: number, obj: any[]) => boolean;
type Predicate = (this: {} | void, value: any, index: number, obj: any[]) => boolean;

Array.prototype.find = function find(callback: Predicate, thisArg?: {}) {
const index = this.findIndex(callback, thisArg);
Expand Down
4 changes: 2 additions & 2 deletions src/shim/object.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,8 @@ if (!has('es2017-object')) {
previous[key] = Object.getOwnPropertyDescriptor(o, key)!;
return previous;
},
{} as { [P in keyof T]: TypedPropertyDescriptor<T[P]> } & { [x: string]: PropertyDescriptor }
);
{} as { [x: string]: PropertyDescriptor }
) as { [P in keyof T]: TypedPropertyDescriptor<T[P]> } & { [x: string]: PropertyDescriptor };
};

Object.entries = function entries(o: any): [string, any][] {
Expand Down
7 changes: 3 additions & 4 deletions src/stores/process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,8 @@ export interface SyncCommand<T = any, P extends object = DefaultPayload> {
*/
export type Command<T = any, P extends object = DefaultPayload> =
| SyncCommand<T, P>
| AsyncCommand<T, P>
| SyncCommandWithOps<T, P>
| AsyncCommandWithOps<T, P>;
| ((request: CommandRequest<T, P>) => Promise<void | PatchOperation<T>[]>)
| SyncCommandWithOps<T, P>;

/**
* Transformer function
Expand Down Expand Up @@ -321,7 +320,7 @@ export function processExecutor<T = any, P extends object = DefaultPayload>(
});

if (isThenable(result)) {
return result.then((result) => {
return result.then((result: any) => {
result = result ? [...proxyOperations, ...result] : [...proxyOperations];

return result;
Expand Down
5 changes: 3 additions & 2 deletions src/testing/mocks/middleware/focus.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { create, invalidator, diffProperty, destroy, node } from '../../../core/vdom';
import focus from '../../../core/middleware/focus';
import icache from '../../../core/middleware/icache';
import focus, { FocusState } from '../../../core/middleware/focus';
import { createICacheMiddleware } from '../../../core/middleware/icache';
import { DefaultMiddlewareResult } from '../../../core/interfaces';

const icache = createICacheMiddleware<FocusState>();
export function createFocusMock() {
const focusNodes: { [key: string]: boolean } = {};
let invalidate: () => void | undefined;
Expand Down
4 changes: 2 additions & 2 deletions tests/core/functional/meta/Drag.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ class DragExample extends WidgetBase {
{
key: 'root',
styles: {
'background-color': dragResults.isDragging ? 'green' : 'white',
backgroundColor: dragResults.isDragging ? 'green' : 'white',
border: '1px solid black',
color: dragResults.isDragging ? 'white' : 'black',
height: '400px',
'user-select': 'none',
userSelect: 'none',
width: '200px'
}
},
Expand Down
4 changes: 2 additions & 2 deletions tests/core/unit/middleware/data.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ jsdomDescribe('data middleware', () => {
assert.strictEqual(root.innerHTML, `<div>${JSON.stringify([{ value: 'foo b' }, { value: 'bar b' }])}</div>`);
});

it('should not convery single sources into strings', () => {
it('should not convert single sources into strings', () => {
resourceStub.getOrRead.returns([{ a: true, b: 2 }, { a: false, b: 3 }, { b: 4 }]);
const factory = create({ data: createDataMiddleware<{ value: string }>() });
const factory = create({ data: createDataMiddleware<{ value: string; foo: string }>() });
const App = factory(function App({ middleware: { data } }) {
const { getOrRead, getOptions } = data();
return <div>{JSON.stringify(getOrRead(getOptions()))}</div>;
Expand Down
10 changes: 5 additions & 5 deletions tests/core/unit/middleware/focus.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ const { describe } = intern.getPlugin('jsdom');
const { assert } = intern.getPlugin('chai');
import { sandbox } from 'sinon';

import focusMiddleware from '../../../../src/core/middleware/focus';
import icacheMiddleware from '../../../../src/core/middleware/icache';
import focusMiddleware, { FocusState } from '../../../../src/core/middleware/focus';
import { createICacheMiddleware } from '../../../../src/core/middleware/icache';

const sb = sandbox.create();
const diffPropertyStub = sb.stub();
Expand All @@ -16,8 +16,8 @@ const nodeStub = {
const invalidatorStub = sb.stub();
const icacheInvalidatorStub = sb.stub();

function icacheFactory() {
return icacheMiddleware().callback({
function icacheFactory<T>() {
return createICacheMiddleware<T>()().callback({
id: 'test-cache',
properties: () => ({}),
children: () => [],
Expand All @@ -36,7 +36,7 @@ describe('focus middleware', () => {
id: 'test',
middleware: {
diffProperty: diffPropertyStub,
icache: icacheFactory(),
icache: icacheFactory<FocusState>(),
destroy: destroyStub,
node: nodeStub,
invalidator: invalidatorStub
Expand Down
2 changes: 2 additions & 0 deletions tests/core/unit/middleware/i18n.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import Map from '../../../../src/shim/Map';

const { it, beforeEach, afterEach } = intern.getInterface('bdd');
const { describe } = intern.getPlugin('jsdom');
const { assert } = intern.getPlugin('chai');
Expand Down
1 change: 1 addition & 0 deletions tests/core/unit/mixins/I18n.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ const { describe } = intern.getPlugin('jsdom');
const { assert } = intern.getPlugin('chai');

import global from '../../../../src/shim/global';
import Map from '../../../../src/shim/Map';
import { renderer, tsx } from '../../../../src/core/vdom';
import WidgetBase from '../../../../src/core/WidgetBase';
import I18nMixin, { registerI18nInjector } from '../../../../src/core/mixins/I18n';
Expand Down
2 changes: 1 addition & 1 deletion tests/core/unit/vdom.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5165,7 +5165,7 @@ jsdomDescribe('vdom', () => {
const div = document.createElement('div');
r.mount({ domNode: div, sync: true });
const root = div.childNodes[0] as HTMLElement;
meta.setRenderResult(v('div', { styles: { height: null, width: '30px' } }));
meta.setRenderResult(v('div', { styles: { height: undefined, width: '30px' } }));

assert.strictEqual(root.outerHTML, '<div style="width: 30px;"></div>');
});
Expand Down
2 changes: 1 addition & 1 deletion tests/shim/unit/array.ts
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ registerSuite('array', {
},

'with union type': function() {
let thing: ArrayLike<number> | Iterable<number> = {
let thing: ArrayLike<number> | Iterable<number | undefined> = {
'0': 0,
'1': 1,
'2': 2,
Expand Down
4 changes: 2 additions & 2 deletions tests/stores/unit/StoreInjector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ interface State {
bar: string;
qux: {
baz: number;
foobar: number;
bar: {
foobar?: number;
bar?: {
foo: {
foobar: {
baz: {
Expand Down
4 changes: 2 additions & 2 deletions tests/stores/unit/StoreProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ interface State {
bar: string;
qux: {
baz: number;
foobar: number;
bar: {
foobar?: number;
bar?: {
foo: {
foobar: {
baz: {
Expand Down