Skip to content

bug: wrong type for defineCustomElements #6832

Description

@danyball

Prerequisites

Stencil Version

4.44.0

Current Behavior

My setup:
Consuming a stencil lib in a React App like:

defineCustomElements().then(() => setAssetPath(
    `${window.location.protocol}//assets.${window.location.host}/`
));

But getting a TS error:
TS2339: Property then does not exist on type void

Expected Behavior

No TS error.

System Info

System: node 22.19.0
    Platform: darwin (25.5.0)
   CPU Model: Apple M1 Max (10 cpus)
    Compiler: /.......node_modules/@stencil/core/compiler/stencil.js
       Build: 1779994050
     Stencil: 4.43.5 🍐
  TypeScript: 5.8.3
      Rollup: 4.44.0
      Parse5: 7.2.1
      jQuery: 4.0.0-pre
      Terser: 5.37.0

Steps to Reproduce

Just add .then() to defineCustomElements() in your consuming project.

Code Reproduction URL

no

Additional Information

/esm/loader.js defining as async which returns Promise:
const defineCustomElements = async (win, options) =>

but

/loader/index.d.ts defining as void:
export declare function defineCustomElements(win?: Window, opts?: CustomElementsDefineOptions): void;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions