Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove ts-strict-ignore for env files and add typing #2683

Merged
merged 1 commit into from
Jun 26, 2024
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
9 changes: 5 additions & 4 deletions ui/src/environments/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export interface Environment {
readonly docsUrlPrefix: string;
readonly links: {

readonly COMMON_STORAGE: string,
readonly COMMON_STORAGE: string | null,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

default value is null, so I added null.

readonly FORGET_PASSWORD: string,
readonly EVCS_KEBA_KECONTACT: string,
readonly EVCS_HARDY_BARTH: string,
Expand All @@ -41,8 +41,9 @@ export interface Environment {
readonly CONTROLLER_API_REST_READ: string,
readonly CONTROLLER_API_REST_READWRITE: string,

readonly SETTINGS_ALERTING: string,
readonly SETTINGS_NETWORK_CONFIGURATION: string,
readonly SETTINGS_ALERTING: string | null,
readonly SETTINGS_NETWORK_CONFIGURATION: string | null,
readonly EVCS_CLUSTER: string,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is this attribute on theme.ts. but in this file this attribute is missing. so I added it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

great 👍


readonly WARRANTY: {
readonly HOME: {
Expand Down Expand Up @@ -89,5 +90,5 @@ export interface Environment {
APP_IMAGE: (language: string, appId: string) => string | null;
},
},
readonly PRODUCT_TYPES: (translate: TranslateService) => Filter
readonly PRODUCT_TYPES: (translate: TranslateService) => Filter | null
}
1 change: 0 additions & 1 deletion ui/src/themes/openems/environments/backend-dev.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { Environment } from "src/environments";
import { theme } from "./theme";

Expand Down
9 changes: 7 additions & 2 deletions ui/src/themes/openems/environments/backend-docker.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
// @ts-strict-ignore
import { Environment } from "src/environments";
import { theme } from "./theme";

// In docker test environment variable window.env is injected.
// cf.
// - tools/docker/ui/root/etc/s6-overlay/s6-rc.d/init-nginx/run
// - tools/docker/ui/assets/env.template.js
const window_env = (window as any).env as { [key: string]: string};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

window is exsiting variable, but window.env is added by project dependent code. typing is needed.


export const environment: Environment = {
...theme, ...{

backend: 'OpenEMS Backend',
url: window["env"]["websocket"],
url: window_env.websocket,

production: true,
debugMode: false,
Expand Down
1 change: 0 additions & 1 deletion ui/src/themes/openems/environments/backend-prod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { Environment } from "src/environments";
import { theme } from "./theme";

Expand Down
1 change: 0 additions & 1 deletion ui/src/themes/openems/environments/edge-dev.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { Environment } from "src/environments";
import { theme } from "./theme";

Expand Down
9 changes: 7 additions & 2 deletions ui/src/themes/openems/environments/edge-docker.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
// @ts-strict-ignore
import { Environment } from "src/environments";
import { theme } from "./theme";

// In docker test environment, variable window.env is injected.
// cf.
// - tools/docker/ui/root/etc/s6-overlay/s6-rc.d/init-nginx/run
// - tools/docker/ui/assets/env.template.js
const window_env = (window as any).env as { [key: string]: string};

export const environment: Environment = {
...theme, ...{

backend: 'OpenEMS Edge',
url: window["env"]["websocket"],
url: window_env.websocket,

production: true,
debugMode: false,
Expand Down
1 change: 0 additions & 1 deletion ui/src/themes/openems/environments/edge-prod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { Environment } from "src/environments";
import { theme } from "./theme";

Expand Down
1 change: 0 additions & 1 deletion ui/src/themes/openems/environments/gitpod.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// @ts-strict-ignore
import { Environment } from "src/environments";
import { theme } from "./theme";

Expand Down