Skip to content

Commit

Permalink
fix: typings build fix, upgrade deps, fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bigopon committed Jan 30, 2023
1 parent e2353e3 commit 0cb1d1d
Show file tree
Hide file tree
Showing 7 changed files with 5,754 additions and 5,841 deletions.
11,571 changes: 5,742 additions & 5,829 deletions package-lock.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -123,12 +123,12 @@
"copyfiles": "^2.0.0",
"coveralls": "^3.0.2",
"cross-env": "^5.2.0",
"dts-bundle-generator": "^1.6.1",
"dts-bundle-generator": "7.2.0",
"husky": "^0.14.3",
"jest": "^24.8.0",
"rimraf": "^2.6.1",
"rollup": "^3.3.0",
"ts-jest": "^23.1.4",
"ts-jest": "^24.0.0",
"ts-node": "^7.0.1",
"tslib": "^2.4.1",
"tslint": "^5.11.0",
Expand Down
4 changes: 2 additions & 2 deletions src/decorator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function connectTo<T, R = any>(settings?: ((store: Store<T>) => Observabl
// otherwise, assume that $store variable in the closure would be already assigned the right
// value from created callback
// Could also be in situation where it doesn't come from custom element, or some exotic setups/scenarios
const store = $store || ($store = Container.instance.get(Store));
const store = $store || ($store = Container.instance.get<Store<T>>(Store));
const source = selector(store);

if (source instanceof Observable) {
Expand Down Expand Up @@ -80,7 +80,7 @@ export function connectTo<T, R = any>(settings?: ((store: Store<T>) => Observabl
// has not been registered somewhere in one of child containers, instead of root container
// if there is any issue with this approach, needs to walk all the way up to resolve from root
// typically like invoking from global Container.instance
$store = view.container.get(Store);
$store = view.container.get<Store<T>>(Store);
if (originalCreated !== undefined) {
return originalCreated.call(this, _, view);
}
Expand Down
2 changes: 1 addition & 1 deletion src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ export class Store<T> {
}

export function dispatchify<T, P extends any[]>(action: Reducer<T, P> | string) {
const store: Store<T> = Container.instance.get(Store);
const store: Store<T> = Container.instance.get<Store<T>>(Store);

return function (...params: P) {
return store.dispatch(action, ...params);
Expand Down
9 changes: 4 additions & 5 deletions test/unit/aurelia-configuration.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import {
Aurelia,
Container,
FrameworkConfiguration
} from "aurelia-framework";

import {
Expand All @@ -16,7 +15,7 @@ interface State {
describe("aurelia setup", () => {
it("should throw an exception if initialState is not provided via options", () => {
const cont = new Container();
const aurelia: FrameworkConfiguration = cont.get(Aurelia);
const aurelia = cont.get(Aurelia);

expect(aurelia.container.hasResolver(Store)).toBeFalsy();

Expand All @@ -25,7 +24,7 @@ describe("aurelia setup", () => {

it("should provide a configuration method registering the store instance", () => {
const cont = new Container();
const aurelia: FrameworkConfiguration = cont.get(Aurelia);
const aurelia = cont.get(Aurelia);

expect(aurelia.container.hasResolver(Store)).toBeFalsy();

Expand All @@ -37,12 +36,12 @@ describe("aurelia setup", () => {

it("should register the store instance with history support", () => {
const cont = new Container();
const aurelia: FrameworkConfiguration = cont.get(Aurelia);
const aurelia = cont.get(Aurelia);

expect(aurelia.container.hasResolver(Store)).toBeFalsy();

configure<State>(aurelia, { initialState: { foo: "bar" }, history: { undoable: true } });

expect(aurelia.container.get(Store).options.history.undoable).toBe(true);
expect(aurelia.container.get(Store)["options"].history?.undoable).toBe(true);
});
});
4 changes: 2 additions & 2 deletions test/unit/middleware.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ describe("middlewares", () => {

try {
await store.dispatch(incrementAction);
} catch (e) {
} catch (e: any) {
expect(e.message).toBe(errorMsg);
}
});
Expand Down Expand Up @@ -470,7 +470,7 @@ describe("middlewares", () => {

try {
await store.dispatch(incrementAction);
} catch (e) {
} catch (e: any) {
expect(e.message).toBe(errorMsg);
}

Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
"noImplicitReturns": true,
"strictNullChecks": true,
"declaration": false,
"allowSyntheticDefaultImports": true,
"forceConsistentCasingInFileNames": true,
"strictPropertyInitialization": false,
"experimentalDecorators": true,
Expand Down

0 comments on commit 0cb1d1d

Please sign in to comment.