You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
And found that the culprit was Type[Property] extends string.
Type[Property] is in my setup typed as BundledLanguage | undefined which causes it to not fullfill the conditional. Type[Property] | string causes the type to be widened to string.
The fact that Type[Property] is typed as BundledLanguage | undefined and not BundledLanguage is due to my tsconfig setting: "noUncheckedIndexedAccess": true.
Patch
I was able to patch it to create the behavior that I wanted in the following way:
hey joe 👋
i have been playing around with
lume/elements
to make custom-element export for solid-shiki-textarea.Issue
I noticed that the attributes of the custom-element were always
string
, while I defined the type with a more narrow type:I extended the namespace with
ElementAttributes<ShikiTextareaElement, ...>
:Own exploration
I had a look inside
ElementAttributes
:And found that the culprit was
Type[Property] extends string
.Type[Property]
is in my setup typed asBundledLanguage | undefined
which causes it to not fullfill the conditional.Type[Property] | string
causes the type to be widened tostring
.The fact that
Type[Property]
is typed asBundledLanguage | undefined
and notBundledLanguage
is due to my tsconfig setting:"noUncheckedIndexedAccess": true
.Patch
I was able to patch it to create the behavior that I wanted in the following way:
where I wrapped
Type[Property]>
in aNonNullable
to excludeundefined
from its type.I am not sure if this is the correct solution, that's why I preferred to write it up as an issue instead of a PR.
The text was updated successfully, but these errors were encountered: