Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: defineCustomElements return type is wrong #4589

Closed
3 tasks done
andrew9994 opened this issue Jul 18, 2023 · 3 comments
Closed
3 tasks done

bug: defineCustomElements return type is wrong #4589

andrew9994 opened this issue Jul 18, 2023 · 3 comments
Assignees
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil

Comments

@andrew9994
Copy link
Contributor

Prerequisites

Stencil Version

4.0.1

Current Behavior

Currently the return type of defineCustomElements is defined as a Promise<void> on this line in the output-lazy-loader,
but the promise got removed in this commit.

Expected Behavior

The return value of defineCustomElements should be typed correctly. However, I am not sure whether this change should be marked as a breaking change.

System Info

No response

Steps to Reproduce

Import defineCustomElements from the loader of a package and try to do something after the promise gets resolved.

import { defineCustomElements } from 'stencil-package/loader';

defineCustomElements().then(() => {
  console.log('elements defined');
})

Code Reproduction URL

n/a

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Jul 18, 2023
@alicewriteswrongs alicewriteswrongs self-assigned this Jul 18, 2023
@alicewriteswrongs
Copy link
Contributor

@andrew9994 thanks for reporting, I was just able to confirm that this is an issue by putting together a quick reproduction here (https://github.com/alicewriteswrongs/stencil-custom-elements-repro)

In the future when reporting issues if you have time to put together something along those lines it greatly helps us in diagnosing problems!

The fix is straightforward here so I'm going to get going on it. Thanks again for filing this!

@alicewriteswrongs alicewriteswrongs added the Bug: Validated This PR or Issue is verified to be a bug within Stencil label Jul 18, 2023
@ionitron-bot ionitron-bot bot removed the triage label Jul 18, 2023
alicewriteswrongs added a commit that referenced this issue Jul 18, 2023
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
alicewriteswrongs added a commit that referenced this issue Jul 18, 2023
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
alicewriteswrongs added a commit that referenced this issue Jul 19, 2023
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
github-merge-queue bot pushed a commit that referenced this issue Jul 19, 2023
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
@andrew9994
Copy link
Contributor Author

Thanks @alicewriteswrongs for jumping on this so quickly 😊 and sorry for not creating a repro repo, will do it next time.

@rwaskiewicz
Copy link
Member

The fix for this issue has been released as a part of today's Stencil v4.0.2 release. As a result, I'm going to close this issue. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug: Validated This PR or Issue is verified to be a bug within Stencil
Projects
None yet
Development

No branches or pull requests

3 participants