Simplify Your TypeScript workflow with typecheck.nvim
Seamless TypeScript type checking.
Photo by Glenn Carstens-Peters on Unsplash
Context
TypeScript development often involves switching between the editor and terminal to run type checks. As someone who regularly works with TypeScript, I've experienced this pain point firsthand. While I explored solutions like tsc.nvim
, they didn't quite fit my needs. Drawing on my experience creating my-note.nvim
and hurl.nvim
, I decided to develop a new tool: typecheck.nvim
.
What is typecheck.nvim?
typecheck.nvim
is a Neovim plugin specifically designed to streamline TypeScript development. It provides real-time type checking, integrating effortlessly with Neovim's quickfix window, which allows for quick navigation and fixing of type errors within your TypeScript projects.
Features
Asynchronous type checking: Run TypeScript compiler (
tsc
) checks without blocking the Neovim UI.Integration with quickfix or trouble.nvim window: View and navigate TypeScript errors and warnings directly within Neovim.
Installation
To integrate typecheck.nvim
into your workflow, include the following in your plugin manager's configuration:
return {
"jellydn/typecheck.nvim",
dependencies = { "folke/trouble.nvim", dependencies = { "nvim-tree/nvim-web-devicons" } },
ft = { "javascript", "javascriptreact", "json", "jsonc", "typescript", "typescriptreact" },
opts = {
debug = true,
mode = "trouble", -- "quickfix" | "trouble"
},
keys = {
{
"<leader>ck",
"<cmd>Typecheck<cr>",
desc = "Run Type Check",
},
}
}
Demo
Simply run :Typecheck
to initiate type checking. The quickfix window pops up to display any errors or warnings, streamlining the error-handling process.
Integration with trouble.nvim
For those who prefer trouble.nvim like me :)
, typecheck.nvim
integrates smoothly, offering an alternative way to navigate and resolve TypeScript issues.
Credits
typecheck.nvim
was inspired by dmmulroy/tsc.nvim
, a Neovim plugin that also focuses on asynchronous, project-wide TypeScript type-checking using the TypeScript compiler (tsc
). Drawing on its core concept, typecheck.nvim
aims to refine and enhance the TypeScript checking experience within Neovim.
Conclusion
Try it out, and let me know what you think!
If you have any suggestions or want to contribute, don't hesitate to send a PR or open an issue on GitHub.