Skip to content

Commit

Permalink
Ian's feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
joeldenning committed Apr 8, 2024
1 parent c108777 commit 1f17a77
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"extends": ["important-stuff"],
"parser": "@typescript-eslint/parser",
"parserOptions": {
"lib": ["dom", "es5", "es2020"]
"project": "./tsconfig.json"
},
"env": {
"browser": true,
Expand Down
7 changes: 5 additions & 2 deletions src/applications/app.helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import {
ActivityFn,
AppOrParcel,
CustomProps,
InternalParcel,
LoadApp,
ParcelMap,
} from "../lifecycles/lifecycle.helpers";
Expand Down Expand Up @@ -54,8 +55,10 @@ export function toName(app) {
return app.name;
}

export function isParcel(appOrParcel) {
return Boolean(appOrParcel.unmountThisParcel);
export function isParcel(
appOrParcel: AppOrParcel
): appOrParcel is InternalParcel {
return Boolean((appOrParcel as InternalParcel).unmountThisParcel);
}

export function objectType(appOrParcel: AppOrParcel): "parcel" | "application" {
Expand Down
8 changes: 5 additions & 3 deletions src/lifecycles/prop.helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import * as singleSpa from "../single-spa";
import { mountParcel } from "../parcels/mount-parcel";
import { isParcel, toName } from "../applications/app.helpers";
import { formatErrorMessage } from "../applications/app-errors";
import { AppOrParcel, InternalParcel } from "./lifecycle.helpers";
import { AppOrParcel, CustomProps, InternalParcel } from "./lifecycle.helpers";

interface SingleSpaProps {
name: string;
Expand All @@ -11,7 +11,9 @@ interface SingleSpaProps {
unmountSelf(): Promise<AppOrParcel>;
}

export function getProps(appOrParcel: AppOrParcel): SingleSpaProps {
export function getProps(
appOrParcel: AppOrParcel
): SingleSpaProps & CustomProps {
const name = toName(appOrParcel);
let customProps =
typeof appOrParcel.customProps === "function"
Expand Down Expand Up @@ -40,7 +42,7 @@ export function getProps(appOrParcel: AppOrParcel): SingleSpaProps {
});

if (isParcel(appOrParcel)) {
result.unmountSelf = (appOrParcel as InternalParcel).unmountThisParcel;
result.unmountSelf = appOrParcel.unmountThisParcel;
}

return result;
Expand Down
7 changes: 6 additions & 1 deletion tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{
"files": ["src/single-spa.ts"],
"include": ["src/declarations.d.ts", "src/window-globals.d.ts"],
"include": [
"src/declarations.d.ts",
"src/window-globals.d.ts",
"src/devtools/profiler-api.ts",
"src/single-spa.profile.ts"
],
"compilerOptions": {
"outDir": "typings",
"emitDeclarationOnly": true,
Expand Down

0 comments on commit 1f17a77

Please sign in to comment.