Skip to main content

Colon and semicolon in Swedish

· 4 min read
Filip Tammergård
Software Engineer at Frilans Finans

Two Swedish punctuation marks I keep second-guessing are the colon (kolon) and the semicolon (semikolon). They look alike, they both sit inside a sentence, and they both replace a word — so this is my reference for which one to use when. (The dash gets its own post.) It's my own summary of the rules as laid out in Siv Strömquist's Skiljeteckensboken.

How to use the dash in Swedish

· 4 min read
Filip Tammergård
Software Engineer at Frilans Finans

The dash (tankstreck) is a punctuation mark I have mixed feelings about. I like it where it actually adds something, and dislike it when it's used carelessly, or written as a hyphen where it should be a dash. (Its siblings the colon and semicolon get their own post.) It's my own summary of the rules as laid out in Siv Strömquist's Skiljeteckensboken.

Difference between useState and useMemo

· 2 min read
Filip Tammergård
Software Engineer at Frilans Finans

The title of this post might seem ridiculous. Of course useState and useMemo are different.

But in one sense, they are quite similar.

Consider this example:

const [state] = useState(() => {
return calculateSomething(input)
})

const memo = useMemo(() => {
return calculateSomething(input)
}, [input])

Excess properties in TypeScript

· 2 min read
Filip Tammergård
Software Engineer at Frilans Finans

Properties defined on an object that are not expressed by the type of the object are called excess properties.

Here's an example:

type Person = {
firstName: string
}

const person: Person = {
firstName: "Filip",
lastName: "Tammergård", // ⛔️ Object literal may only specify known properties, and 'lastName' does not exist in type 'Person'.
}

In this case, TypeScript makes it clear that lastName is not defined in the Person type and is therefore not allowed.

Mouse, Touch and Pointer events

· 6 min read
Filip Tammergård
Software Engineer at Frilans Finans

I recently stumbled upon a bug related to the subtle differences between mouse, touch and pointer events. The bug made me confused—and curious. What is actually the difference between these events?

I opened an issue for the bug that you can check out if you're also curious—but before trying to understand the bug, we need to set the stage with some knowledge around different types of events.