Set input value as selected item with Algolia Autocomplete

I’m using Algolia Autocomplete with a custom JSON source. It works fine except I can’t see how to update the value of the input to the value of the selected autocomplete dropdown when a user picks one of the options.

HTML:

<div id="autocomplete"></div>
<div id="results-container"></div>

TypeScript:

import { autocomplete } from '@algolia/autocomplete-js';
import '@algolia/autocomplete-theme-classic';

function init() {
  autocomplete({
    container: '#autocomplete',
    panelContainer: '#results-container',
    placeholder: 'Search for schools...',
    getSources({ query }) {
      return [
        {
          sourceId: 'schoolsAPI',
          getItems() {
            return fetch(`/api/schoolslookup?q=${query}&limit=20`)
              .then(response => response.json())
              .then(data => data);
          },
          templates: {
            item({ item, html }) {
              return html`<div>${item.name}</div>`;
            },
            noResults() {
              return 'No results.';
            },
          },
          onSelect({ event }) {
            const selectedEl = event.target as HTMLDivElement;
            const input = document.querySelector<HTMLInputElement>('.aa-Input');
            if (input) {
              input.value = selectedEl.innerText;
              // eslint-disable-next-line no-console
              console.log(selectedEl.innerText);
            }
          }
        }
      ];
    },
  });
}

export default () => {
  init();
};

As per the code, I’ve tried using the onSelect method in the autocomplete source and that does show the correct value being logged to the console. It also successfully gets the input element. It doesn’t seem to update the value of the input though, so I’m not sure if that’s even the way to go about it or whether Algolia Autocomplete uses some other dynamic element to display the selected value. I can’t find anything in the documentation that details how to do this. All examples I can find use:

.on('autocomplete:selected', function(event, suggestion, dataset) {
  console.log(suggestion, dataset);
})

…but the on method does not seem to exist in the version of Algolia Autocomplete I’m using (1.17.2).