Skip to content

Commit

Permalink
Fixed a bad renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
patricklafrance committed Dec 4, 2023
1 parent b0bdbad commit 472b516
Show file tree
Hide file tree
Showing 8 changed files with 734 additions and 688 deletions.
4 changes: 2 additions & 2 deletions docs/getting-started/create-local-module.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@ pnpm add @squide/firefly react react-dom react-router-dom react-error-boundary
```
+++ yarn
```bash
pnpm add -D @workleap/tsup-configs tsup typescript
yarn add -D @workleap/tsup-configs tsup typescript
yarn add @squide/firefly react @squide/firefly react-dom react-router-dom react-error-boundary
```
+++ npm
```bash
pnpm add -D @workleap/tsup-configs tsup typescript
npm add -D @workleap/tsup-configs tsup typescript
npm install @squide/firefly react react-dom react-router-dom react-error-boundary
```
+++
Expand Down
2 changes: 1 addition & 1 deletion packages/firefly/src/AppRouter.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ interface BootstrappingRouteProps {
areModulesReady: boolean;
}

function isPromise(value: any) {
function isPromise<T = unknown>(value: any): value is Promise<T> {
return !isNil(value) && !isNil(value.then) && !isNil(value.catch);
}

Expand Down
1,396 changes: 721 additions & 675 deletions pnpm-lock.yaml

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions samples/endpoints/host/mocks/characterHandlers.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
/* eslint-disable max-len */

import { HttpResponse, http, type HttpHandler } from "msw";
import { readonlyLocalStorage } from "./session.ts";
import { readonlySessionLocalStorage } from "./session.ts";

// Must specify the return type, otherwise we get a TS2742: The inferred type cannot be named without a reference to X. This is likely not portable.
// A type annotation is necessary.
export const characterHandlers: HttpHandler[] = [
http.get("/api/character/1,2", async () => {
const session = readonlyLocalStorage.getSession();
const session = readonlySessionLocalStorage.getSession();

if (!session) {
return new HttpResponse(null, {
Expand Down
4 changes: 2 additions & 2 deletions samples/endpoints/host/mocks/session.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { FakeSessionKey } from "@endpoints/shared";
import { ReadonlyLocalStorage } from "@squide/fakes";
import { ReadonlySessionLocalStorage } from "@squide/fakes";

export interface Session {
userId: number;
username: string;
preferredLanguage: string;
}

export const readonlyLocalStorage = new ReadonlyLocalStorage<Session>({ key: FakeSessionKey });
export const readonlySessionLocalStorage = new ReadonlySessionLocalStorage<Session>({ key: FakeSessionKey });
4 changes: 2 additions & 2 deletions samples/endpoints/local-module/mocks/characterHandlers.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/* eslint-disable max-len */

import { HttpResponse, http, type HttpHandler } from "msw";
import { readonlyLocalStorage } from "./session.ts";
import { readonlySessionLocalStorage } from "./session.ts";

function simulateDelay(delay: number) {
return new Promise(resolve => {
Expand All @@ -17,7 +17,7 @@ export const characterHandlers: HttpHandler[] = [
http.get("/api/character/1,2", async () => {
await simulateDelay(2000);

const session = readonlyLocalStorage.getSession();
const session = readonlySessionLocalStorage.getSession();

if (!session) {
return new HttpResponse(null, {
Expand Down
4 changes: 2 additions & 2 deletions samples/endpoints/local-module/mocks/session.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { FakeSessionKey } from "@endpoints/shared";
import { ReadonlyLocalStorage } from "@squide/fakes";
import { ReadonlySessionLocalStorage } from "@squide/fakes";

export interface Session {
userId: number;
username: string;
preferredLanguage: string;
}

export const readonlyLocalStorage = new ReadonlyLocalStorage<Session>({ key: FakeSessionKey });
export const readonlySessionLocalStorage = new ReadonlySessionLocalStorage<Session>({ key: FakeSessionKey });
4 changes: 2 additions & 2 deletions samples/endpoints/remote-module/mocks/session.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { FakeSessionKey } from "@endpoints/shared";
import { ReadonlyLocalStorage } from "@squide/fakes";
import { ReadonlySessionLocalStorage } from "@squide/fakes";

export interface Session {
userId: number;
username: string;
preferredLanguage: string;
}

export const readonlyLocalStorage = new ReadonlyLocalStorage<Session>({ key: FakeSessionKey });
export const readonlySessionLocalStorage = new ReadonlySessionLocalStorage<Session>({ key: FakeSessionKey });

0 comments on commit 472b516

Please sign in to comment.