April 11th, 2020

(no subject)

Here was me happily using a type for a redux thunk action that I copy-pasted from somewhere many months ago:



The types passed to the ThunkAction generic type here aren't important. What is important is that I was using the ActionCreator type from the redux library. The reason this is important is that when, during refactoring, I changed the action creator so that instead of a single argument (x) it now requires two (x and y):



I fully expected typescript to complain in the places where someActionCreator was invoked with a single argument. When it didn't, I cussed, went to investigate, and found that the ActionCreator type is defined in the redux library as follows:



Bloody any! Now, I don't know whether there is a proper way to define the type of ActionCreator in typescript at all; but by using any we have just lost the information about how many and what kind of arguments someActionCreator will require.

Horror!

P.S.: found the discussion of this problem in redux's github issues.

(no subject)

The deeply unesthetic octothorpe seems to be creeping into the JavaScript language, after just as unappealing asterisk. There already are private fields and private methods, which, as opposed to the much cleaner "private" keyword in Typescript, use the octothorpe:



And here, according to Twitter, is the proposal for immutable records and tuples:





The functionality is very welcome. The hash sign less so.