LaTeX.js
LaTeX.js copied to clipboard
new Macros need HtmlGenerator but "this" point to Generator in generator
https://github.com/michael-brade/LaTeX.js/blob/245ca82d22c9f9d4dc34041833316667b2f17af6/src/generator.ls#L84
function Macros in Generator class use "this" which point to Generator in typescript. but argument "this" should point to HtmlGenerator. Do you have ang suggestion how to handle this ?
I don't understand this one... this points to the current class, and if that is HtmlGenerator (derived from Generator), then this is HtmlGenerator. Why should it be different in TypeScript?
because argument type defined in function Macros is HtmlGenerator. "new Macros" in Generator takes "this" as Generator. so type check will fail.
i will try to disable TS type check here.
ahhh. Yes, this is a thing I haven't fixed yet: Macros should NOT depend on HtmlGenerator, only on the Generator interface. So don't disable the type check there, just cast the Generator to HtmlGenerator and make Macros take a Generator.