Monday, September 06, 2021

TypeScript 4.4: "catch uknown"

many new linter errors with TypeScript upgrade... 
"solution": catch (err: any)

Announcing T TypeScript 4.4 |ypeScript

In JavaScript, any type of value can be thrown with throw and caught in a catch clause. Because of this, TypeScript historically typed catch clause variables as any, and would not allow any other type annotation:

That’s why TypeScript 4.4 introduces a new flag called --useUnknownInCatchVariables. This flag changes the default type of catch clause variables from any to unknown.

try {
catch (err) { // err: unknown (default type, used to be "any")

    // Error! Property 'message' does not exist on type 'unknown'.

    // Works! We can narrow 'err' from 'unknown' to 'Error'.
    if (err instanceof Error) {

Geekout: Renewable Energy

It is recorded over SpaceX StarLink satellite internet!
Apparently StarLink is quite usable already!

Geekout: Renewable Energy - Talk Python Live Stream Episode 329 - YouTube

Episode #329 Geekout: Renewable Energy - [Talk Python To Me Podcast]

Links from the show

Richard on Twitter: @richcampbell

IEA report 2021:
Flywheel storage:
Crane storage:
Pumped hydro storage:
Tesla battery utility-scale:
The US’s largest solar farm is canceled because Nevada locals don’t want to look at it:
DEVintersection conference (run by Richard):
.NET Rocks Podcast (Richard's a cohost, many geekout episodes):

Prior Geekouts on Talk Python
#276: Geekout: Life in the solar system and beyond:
#253: Moon base geekout:
Episode transcripts: