Fix TypeScript type assertions and null safety
This commit is contained in:
parent
499ab7f769
commit
b730f394e6
|
|
@ -193,7 +193,7 @@ function makeComponent(baseName: string, rootDef: TagDef, rootProps: Record<stri
|
|||
|
||||
const finalProps = { class: classNames.join(' '), ...baseAttrs, ...props, children }
|
||||
|
||||
if (finalProps.dangerouslySetInnerHTML) {
|
||||
if ((finalProps as any).dangerouslySetInnerHTML) {
|
||||
const { children: _, ...rest } = finalProps
|
||||
return <Tag {...rest} />
|
||||
}
|
||||
|
|
@ -284,7 +284,7 @@ export function createScope(scope: string) {
|
|||
return {
|
||||
define: (nameOrDef: string | TagDef, defIfNamed?: TagDef) => {
|
||||
if (typeof nameOrDef === 'string')
|
||||
return define(`${scope}${nameOrDef === 'Root' ? '' : nameOrDef}`, defIfNamed)
|
||||
return define(`${scope}${nameOrDef === 'Root' ? '' : nameOrDef}`, defIfNamed!)
|
||||
else
|
||||
return define(`${scope}${anonName(nameOrDef)}`, nameOrDef as TagDef)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user