constructor(workspace, btnCallbackName, types, optMessages) {
    const title =
      (optMessages && optMessages['TYPED_VAR_MODAL_TITLE']) ||
      'Create Typed Variable';
    super(title, workspace);

    /**
     * The id of the currently selected type.
     * @type {?string}
     * @private
     */
    this.selectedType_ = null;

    /**
     * The input div holding the name of the variable.
     * @type {HTMLInputElement}
     * @protected
     */
    this.variableNameInput_ = null;

    /**
     * The div holding the list of variable types.
     * @type {HTMLElement}
     * @protected
     */
    this.variableTypesDiv_ = null;

    /**
     * The first type input.
     * @type {HTMLInputElement}
     * @protected
     */
    this.firstTypeInput_ = null;

    /**
     * The name used to register the button callback.
     * @type {string}
     * @private
     */
    this.btnCallBackName_ = btnCallbackName;

    /**
     * An array holding arrays with the name of the type and the display name
     *     for the type. Ex: [['Penguin', 'PENGUIN'], ['Giraffe', 'GIRAFFE']].
     * @type {Array<Array<string>>}
     * @protected
     */
    this.types_ = types;

    const messages = {
      TYPED_VAR_MODAL_TITLE: 'Create Typed Variable',
      TYPED_VAR_MODAL_VARIABLE_NAME_LABEL: 'Variable Name: ',
      TYPED_VAR_MODAL_TYPES_LABEL: 'Variable Types',
      TYPED_VAR_MODAL_CONFIRM_BUTTON: 'Ok',
      TYPED_VAR_MODAL_CANCEL_BUTTON: 'Cancel',
      TYPED_VAR_MODAL_INVALID_NAME:
        'Name is not valid. Please choose a different name.',
    };

    Object.assign(messages, optMessages);

    this.setLocale(messages);

    /**
     * If true close the modal when the user clicks outside the modal.
     * Otherwise, only close when user hits the 'X' button or escape.
     * @type {boolean}
     * @override
     */
    this.shouldCloseOnOverlayClick = false;
  }
Constructor for creating a typed variable modal.
@param {!Blockly.WorkspaceSvg} workspace The workspace that the modal will
    be registered on.
@param {string} btnCallbackName The name used to register the button
    callback.
@param {Array<Array<string>>} types An array holding arrays with the
    display name as the first value and the type as the second.
    Ex: [['Penguin', 'PENGUIN'], ['Giraffe', 'GIRAFFE']].
@param {TypedVarModalMessages} optMessages The messages for a typed
    variable modal.