types: cast in jsx.tsx to avoid @ts-ignore
This commit is contained in:
		
							parent
							
								
									50a87d0d86
								
							
						
					
					
						commit
						22b7cf135e
					
				
					 1 changed files with 3 additions and 4 deletions
				
			
		| 
						 | 
					@ -1,4 +1,4 @@
 | 
				
			||||||
import { Components, toJsxRuntime } from "hast-util-to-jsx-runtime"
 | 
					import { Components, Jsx, toJsxRuntime } from "hast-util-to-jsx-runtime"
 | 
				
			||||||
import { QuartzPluginData } from "../plugins/vfile"
 | 
					import { QuartzPluginData } from "../plugins/vfile"
 | 
				
			||||||
import { Node, Root } from "hast"
 | 
					import { Node, Root } from "hast"
 | 
				
			||||||
import { Fragment, jsx, jsxs } from "preact/jsx-runtime"
 | 
					import { Fragment, jsx, jsxs } from "preact/jsx-runtime"
 | 
				
			||||||
| 
						 | 
					@ -15,11 +15,10 @@ const customComponents: Components = {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export function htmlToJsx(fp: FilePath, tree: Node<QuartzPluginData>) {
 | 
					export function htmlToJsx(fp: FilePath, tree: Node<QuartzPluginData>) {
 | 
				
			||||||
  try {
 | 
					  try {
 | 
				
			||||||
    // @ts-ignore (preact makes it angry)
 | 
					 | 
				
			||||||
    return toJsxRuntime(tree as Root, {
 | 
					    return toJsxRuntime(tree as Root, {
 | 
				
			||||||
      Fragment,
 | 
					      Fragment,
 | 
				
			||||||
      jsx,
 | 
					      jsx: jsx as Jsx,
 | 
				
			||||||
      jsxs,
 | 
					      jsxs: jsxs as Jsx,
 | 
				
			||||||
      elementAttributeNameCase: "html",
 | 
					      elementAttributeNameCase: "html",
 | 
				
			||||||
      components: customComponents,
 | 
					      components: customComponents,
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue