-
Notifications
You must be signed in to change notification settings - Fork 174
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
Typescript error : Type 'HTMLElement | null' is not assignable to type 'string | HTMLElement | undefined'. #828
Comments
Sorry, I can't reproduce this type error :/ |
No worries, thanks for Oruga ;-) |
Sorry, I didn't see that you'd changed your comment, after I replied. I've got the error in my project, I'll look into making a reproduction. |
Hello, I've updated a branch of my project where I'm testing the version 0.8 of bulma to the new version 0.8.6. I have fewer errors. However, I still get this error in vscode, or with vue-tsc. Here are some screenshots. The type of The error: I think a solution would be to change the container type here to accept null. /**
* DOM element where the loading component will be created on (for programmatic usage).
* Note that this also changes fullPage to false.
*/
container: {
- type: [Object, String] as PropType<string | HTMLElement>,
+ type: [Object, String] as PropType<string | HTMLElement | null>,
default: () => getOption("loading.container", "body"),
}, I cannot reproduce it in a simple example. But I think there is an issue in my repro because, the type of My repro : https://stackblitz.com/~/github.com/messenjer/oruga-typeerror Regards Mathieu |
@messenjer Try deleting the However, i will consider adding |
Overview of the problem
Oruga version: 0.8.5
Vuejs version: 3.4.19
OS/Browser:
Description
When I upgrade to oruga 0.8, I have a typescript error.
Steps to reproduce
src/pages/MyPage.vue:260:49 - error TS2322: Type 'HTMLElement | null' is not assignable to type 'string | HTMLElement | undefined'.
260 const loadingComponent = oruga.loading.open({ container: eltRef.value });
Expected behavior
As in the documentation, you must be able to have container === null
oruga/packages/docs/.vitepress/theme/examples/loading/programmatically.vue
Line 16 in 9693d7c
function openLoading() { const loadingComponent = oruga.loading.open({ fullPage: isFullPage.value, + container: isFullPage.value ? null : elementRef.value, }); setTimeout(() => loadingComponent.close(), 3 * 1000); }
Actual behavior
error TS2322: Type 'HTMLElement | null' is not assignable to type 'string | HTMLElement | undefined'.
The text was updated successfully, but these errors were encountered: