K

cursor-selection-handling

How to Use
Run this codemod on your codebase using one of the following commands

The easiest way to run this codemod without installing anything globally:

Documentation

This codemod shows how to migrate cursor and selection handling from Slate v0.88 to v0.104, including the Preventing runtime errors from null selections.

Code Changes

Version 0.88

typescript

Version 0.104

typescript

Key Changes

  • Added explicit type casting to Range | null
  • Implemented null safety check using conditional block
  • Ensures selection exists before accessing its properties

Migration Benefits

  • Prevents runtime errors from null selections
  • Provides better TypeScript type safety
  • Follows current best practices for Slate selection handling

Ready to contribute?

Build your own codemod and share it with the community.