npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

xstate-tsserver

v0.0.6

Published

XState tsserver plugin for easier navigation in state machines

Downloads

819

Readme

XState TypeScript Language Service Plugin

Enhance your TypeScript experience when working with XState state machines! This TypeScript TSServer plugin provides better navigation for state machine configurations inside your IDE.


Features

Go to Definition (F12/gd) to jump from a given action, guard, actor, or delay to its definition within the setup block of a machine. ✅ Find all references (Shift+F12/gr) to list implementations of a given action, guard, actor, or delay. ✅ Jump to state target (F12/gd) from a transition target or initial state to the state. ✅ Autocompletions for state targets for a transition target or initial state.

Coming soon

🛠️ Show implementation on hover of the given implementation of a given action, guard, actor, or delay. 🛠️ Diagnostics on invalid states show errors when the state target or initial state is invalid. If the initial state does not exist then show a warning 🛠️ Code actions for building a state machine to add states, transitions, actions, guards, etc.


Installation

You can install the plugin globally or per project.

📌 Project Installation

To install the plugin in your project, simply run:

npm install --save-dev xstate-tsserver

📌 Global Installation

You can also install the plugin globally by running:

npm install -g xstate-tsserver

You will also need to add your global node_modules path to tsserver's plugin paths.

For example, in VSCode, you can edit your settings.json to add the plugin path:

{
  "typescript.tsserver.pluginPaths": ["path/to/global/node_modules"]
}

💡 Tip: You can find your global node_modules path by running:

npm root -g

Plugin activation

Modify your tsconfig.json to include the plugin:

{
  "compilerOptions": {
    "plugins": [{ "name": "xstate-tsserver" }]
  }
}

Restart the TypeScript server (in VSCode by running "TypeScript: Restart TS Server" from the command palette)

TODO: Make a vscode extension to activate the plugin globally


Usage

XState tsserver extends the regular tsserver definitions to make navigating around a state machine much easier

Go to implementation definition

Under any named action, guard, actor or delay within the machine config, go to definition will navigate to it's implementation within the setup block of the machine.

💡 Tip: In VSCode, hover over the implementation and press F12 or cmd+click to navigate to the definition.

Find implementation references

Under any named action, guard, actor or delay within the machine config, find all references will navigate to it's implementation within the setup block of the machine and show other uses of it in the machine config

💡 Tip: In VSCode, hover over the implementation and press shift+F12 to navigate to the definition.

Jump to state target

Under any transition target or initial state within the machine config, go to definition will navigate to that target state

💡 Tip: In VSCode, hover over the state name and press F12 or cmd+click to navigate to the state config.

Get autocompletions for state targets

Under any transition target or initial state within the machine config, the autocompletion array will show all the valid state targets.

💡 Tip: In VSCode, press ctrl+space to show the autocompletion list for valid state targets.


Troubleshooting

💡 Tip: Open TS Server Logs ("TypeScript: Open TS Server Logs") to verify that the plugin is loaded. You should see this log line xstate tsserver loaded


Contributing

Contributions are welcome! 🚀 If you find any issues or have ideas to improve the plugin, feel free to:

  • Submit an issue on GitHub.
  • Open a pull request with improvements.

Resources


License

MIT License. 📝