Patches built-in TypeScript declarations to use stricter numeric types in DataView and TypedArray sub-classes.
Read more about it in this blog post: https://tobloef.com/blog/stricter-typescript-numerics.
To run it, simply enter the root folder of your project (the one containing the node_modules folder) and run:
npx typescript-numeric-type-patchYou can optionally specify the path of your project manually:
npx typescript-numeric-type-patch ./path/to/projectBy default, the patcher will use "loosely" branded types (number is assignable to Int32). If you want to use "stricly" branded types (number has to be cast to Int32), you can use the --strict flag:
npx typescript-numeric-type-patch --strictIf you don't want to run this manually every time you install TypeScript in your project, you can generate patch files with patch-package for Node.js or bun patch for Bun.