Typescript Timer Number

It appears that in a recent updates to either type definitions in my project, or some library, that a few of my timeouts and intervals might be causing issues: ERROR in [at-loader] ./src/pages/ExamplePage.tsx:41:23 TS2345: Argument of type '{ intervalId: Timer; }' is not assignable to parameter of type 'Pick<IState, "intervalId">'. Types of property 'intervalId' are incompatible. Type 'Timer' is not assignable to type 'number'. After a little digging, I was able to find that using window.

SublimeText Multiple Cursors or Carets

I’ve been using MacVim forever, and finally switched to using SublimeText with the vintage mode enabled. It’s scratching many of the itches I’ve had, but one of the main things I liked to do in vim was stuff like prepending content to multiple lines by selecting multiple lines and then typing: :norm!Iprefix content After a little digging, I found that you can add the following keybindings: [ { "keys": ["super+up"], "command": "select_lines", "args": {"forward": false} }, { "keys": ["super+down"], "command": "select_lines", "args": {"forward": true} } ] Now you can hit your command key and an up/down arrow to get multiple cursors, and then perform the insert to all the lines.

React State-Transform Pattern

The Problem When working with React, one issue I’ve run into is the reusability of certain functionalities in my React Components, but I’ve found that something feels a little weird to be: class StateMicroChangeComponent extends React.Component { ... handleSelectCategory(selectedCategory) { let allResults = this.state.allResults; let filteredResults = this.filterResults(allResults, selectedCategory); filteredResults = this.sortResults(filteredResults); this.setState({ filteredResults, selectedCategory, }); } ... } In the above example, I’m happy if there’s only one instance where we perform the filtering/sorting, but if our Component performs these tasks multiple times, it might be difficult to maintain.