Skip to content

Export math-static-elements.ts for using static element types#3009

Open
tsuji-riya wants to merge 1 commit into
arnog:masterfrom
tsuji-riya:export-math-static-elements
Open

Export math-static-elements.ts for using static element types#3009
tsuji-riya wants to merge 1 commit into
arnog:masterfrom
tsuji-riya:export-math-static-elements

Conversation

@tsuji-riya
Copy link
Copy Markdown

MathSpanElement (and related static element types) were not accessible from the public types, making it impossible to pass type check mathSpanElement.render() even if using TypeScript.

I added export * from './math-static-elements' to src/public/mathlive.ts.
This exposes MathSpanElement, MathDivElement so I can type-check references to / elements and call their methods without casting to any or unknown.

Example

import type { MathSpanElement } from 'mathlive';
const mathSpanRef = useRef<MathSpanElement>(null);

mathSpanRef.current?.render();

return (<math-span ref={mathSpanRef} />);

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant