Skip to content

Commit

Permalink
fix(compile_error): fixed typescript error
Browse files Browse the repository at this point in the history
  • Loading branch information
JannisDommer committed Jan 9, 2024
1 parent e0e812e commit dab2f0d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions WebSocketClient/src/uvlTutorial.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ export default function initUvlTutorial(editor: editor.IStandaloneCodeEditor) {
}
}

function changesViewOnClick(tutorialDiv: HTMLElement, paragraph: HTMLParagraphElement, originalCode: string, modifiedCode: string) {
if(paragraph.textContent === "Show Changes ›"){
function changesViewOnClick(tutorialDiv: HTMLElement | null, paragraph: HTMLParagraphElement, originalCode: string | undefined, modifiedCode: string | undefined) {
if(paragraph.textContent === "Show Changes ›" && tutorialDiv && originalCode && modifiedCode){
const editordiv = document.createElement("div");
editordiv.id = "diffEditorDiv";
tutorialDiv.appendChild(editordiv);
Expand Down Expand Up @@ -139,9 +139,11 @@ export default function initUvlTutorial(editor: editor.IStandaloneCodeEditor) {

paragraph.textContent = "Hide Changes"
}
else if(paragraph.textContent === "Hide Changes"){
else if(paragraph.textContent === "Hide Changes" && tutorialDiv){
const diffEditor = document.getElementById("diffEditorDiv");
tutorialDiv.removeChild(diffEditor);
if (diffEditor){
tutorialDiv.removeChild(diffEditor);
}

paragraph.textContent = "Show Changes ›"
}
Expand Down

0 comments on commit dab2f0d

Please sign in to comment.