I am interested in using Reveal.js in an SPA in TypeScript, so I created index.d.ts. I do have problem with some typings, though. Basically, anything that get marked as any, for example
function getSlide(x: any, y: any): HTMLElement;function registerPlugin(id: string, plugin: any): void;function addKeyBinding(binding: any, callback: () => void): void;There is @types/reveal, but it is probably deprecated.
@patarapolw How does Reveal import into typescript?
I tried it this way but it doesn't work for me:
import * as Reveal from 'reveal';
declare var Reveal: any;
can you help me please
@lliccien
Try this repo -- https://github.com/patarapolw/reveal-md/blob/c5721ded7aeaf60902b4c5b9b08aadc32317bfcf/web/src/lib/reveal-md.ts#L1
Basically, copy reveal-d.ts to make it suit your needs.
I also need the typings... it makes not more sense if the creator of revealjs adds the typings to the original source repository? @hakimel please add it ;)
A response by the maintainer would be great here.
Is there already work done on 4.x types?
Does the implementation of types need help by the community?
Are types simply not intended for the project at all?
I am having the same problems, there is no way of getting it running when I import it in a TypeScript file that gets processed by Webpack with the Symfony Webpack Encore.
I only get it running when importing a second js file containing :
import Reveal from 'reveal.js';
import Markdown from 'reveal.js/plugin/markdown/markdown.esm.js';
import Highlight from 'reveal.js/plugin/highlight/highlight.esm';
let Reveal = new Reveal({
plugins: [
Markdown,
Highlight
],
hash: true
})
Reveal.initialize();
Unfortunately when trying to run this with Decktape is not working as typeof Reveal is always undefined ... I'll come back if I find a way to get this to work
Most helpful comment
I also need the typings... it makes not more sense if the creator of revealjs adds the typings to the original source repository? @hakimel please add it ;)