Skip to content

Can I write local plugins in TypeScript? #4657

Answered by slorber
borekb asked this question in Q&A
Discussion options

You must be logged in to vote

Hmm I don't think we support config in TS for now, but maybe try and report :)

Maybe it would be complicated to achieve (require running Docusaurus with ts-node) or not convenient (require compiling the plugin to js first), not sure?

However you can probably get some autocompletion support with jsdoc annotations

/** @type {import('@docusaurus/types').Plugin} */
function MyPlugin() {
  return {
    name,
  };
}

Can be good enough for now?

Also we'll allow passing a function directly for the plugin so you could write more easily the plugin directly in the config file (if that make sense): #4618

Replies: 1 comment 4 replies

Comment options

You must be logged in to vote
4 replies
@borekb
Comment options

@slorber
Comment options

slorber Apr 22, 2021
Collaborator

@borekb
Comment options

@slorber
Comment options

slorber Apr 22, 2021
Collaborator

Answer selected by borekb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants