Skip to content

Instantly share code, notes, and snippets.

View giacomoran's full-sized avatar

Giacomo Randazzo giacomoran

View GitHub Profile
@shicks
shicks / index.md
Last active August 14, 2023 03:41
My TypeScript generics wishlist

Background: TypeScript Generics Wishlist

There are a handful of issues that are both separate features, but are also loosely related in that they speak to certain problematic aspects of generics today. In particular,

  • [#7061] (specifically later in the thread) asks for a way to assign a private alias to a complex typed derived from the actual type parameters, usable from within the class/function signature. There are suggestions to use namespaces and other hacks, along with explanations of why <T, U extends Foo<T> = Foo<T>> is insufficient.
  • [#26242] and [#16597] both pertain to partial inference of type parameters. The rough summary is that you can write ``, but there's no way to explicitly specify T and still get inference on `U`. If you
@paulirish
paulirish / what-forces-layout.md
Last active May 16, 2025 01:11
What forces layout/reflow. The comprehensive list.

What forces layout / reflow

All of the below properties or methods, when requested/called in JavaScript, will trigger the browser to synchronously calculate the style and layout*. This is also called reflow or layout thrashing, and is common performance bottleneck.

Generally, all APIs that synchronously provide layout metrics will trigger forced reflow / layout. Read on for additional cases and details.

Element APIs

Getting box metrics
  • elem.offsetLeft, elem.offsetTop, elem.offsetWidth, elem.offsetHeight, elem.offsetParent