asExpectedType

fun Base.asExpectedType(questionnaireItemType: Questionnaire.QuestionnaireItemType? = null): Type

Returns the Base object as a Type as expected by Questionnaire.QuestionnaireItemAnswerOptionComponent.setValue. Also, Questionnaire.QuestionnaireItemAnswerOptionComponent.setValue only takes a certain Type objects and throws exception otherwise. This extension function takes care of the conversion based on the input and expected Type.