Adding the highlightjs API interface to self in a web worker?

I’m coding a web worker in Typescript and this works:

onmessage = (e) => {
    importScripts(
      'https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.10.0/highlight.min.js'
    );
    const language = e.data.language;
    const result = language
      ? (self as any).hljs.highlightAuto(e.data.code, { language })
      : (self as any).hljs.highlightAuto(e.data.code);
    postMessage(result.value);
  };

I’m curious if there is a way to type self more strictly with the types from @types/highlightjs?