Skip to content

Commit

Permalink
fix(lazy): adjust the type of defineCustomElements
Browse files Browse the repository at this point in the history
This fixes an issue with the type for `defineCustomElements` that we set
in output-lazy-loader.ts. In #4419 we changed the return type of the
function to be `void` (at runtime) but we didn't make a corresponding
adjustment to the type declaration for the function that we generate
here:

https://github.com/ionic-team/stencil/blob/7d5dc6cf5e0d2020c513cc87b6b2e5b93eece9bc/src/compiler/output-targets/output-lazy-loader.ts#L88

This change adjusts that type declaration to have a `void` return value,
instead of `Promise<void>`.

See #4589 for more context
  • Loading branch information
alicewriteswrongs committed Jul 19, 2023
1 parent 9d2d0a0 commit b37afd2
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/compiler/output-targets/dist-lazy/lazy-output.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ const getLazyEntry = (isBrowser: boolean): string => {
} else {
s.append(`import { globalScripts } from '${STENCIL_APP_GLOBALS_ID}';\n`);
s.append(`export const defineCustomElements = (win, options) => {\n`);
s.append(` if (typeof window === 'undefined') return Promise.resolve();\n`);
s.append(` if (typeof window === 'undefined') return undefined;\n`);
s.append(` globalScripts();\n`);
s.append(` return bootstrapLazy([/*!__STENCIL_LAZY_DATA__*/], options);\n`);
s.append(`};\n`);
Expand Down
2 changes: 1 addition & 1 deletion src/compiler/output-targets/output-lazy-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export interface CustomElementsDefineOptions {
ael?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
rel?: (el: EventTarget, eventName: string, listener: EventListenerOrEventListenerObject, options: boolean | AddEventListenerOptions) => void;
}
export declare function defineCustomElements(win?: Window, opts?: CustomElementsDefineOptions): Promise<void>;
export declare function defineCustomElements(win?: Window, opts?: CustomElementsDefineOptions): void;
export declare function applyPolyfills(): Promise<void>;
/**
Expand Down

0 comments on commit b37afd2

Please sign in to comment.