import {Response} from "quill-marking-logic"

interface Attempt {
  response: Response
}

function getAnswerState(attempt: Attempt|undefined): boolean {
  if (attempt) {
    return (!!attempt.response.optimal && attempt.response.author === undefined)
  }
  return false
}

export default getAnswerState;
import {Response} from "quill-marking-logic"

interface Attempt {
  response: Response
}

function getAnswerState(attempt): boolean {
  return (attempt.response.optimal && attempt.response.author === undefined && attempt.author === undefined)
}

export default getAnswerState;
--- 
+++ 
@@ -4,8 +4,11 @@
   response: Response
 }
 
-function getAnswerState(attempt): boolean {
-  return (attempt.response.optimal && attempt.response.author === undefined && attempt.author === undefined)
+function getAnswerState(attempt: Attempt|undefined): boolean {
+  if (attempt) {
+    return (!!attempt.response.optimal && attempt.response.author === undefined)
+  }
+  return false
 }
 
 export default getAnswerState;
Fix answer state null error.
