MENU
  

# How to type check a .js project using ts7 preview:
tsgo --noEmit --allowJs --checkJs --module nodenext --esModuleInterop --target es2023 main.js


# object type with a subset of keys compared to another object type:
# Pick<T, "key1" | "key2">

# object type with all but a subset of keys compared to another object type:
# Omit<T, "key1" | "key2">

# Extract<> and Exclude<> are the same, but for union types instead of object types

# utility type (useful in libraries) for creating "prettified types" instead of
# dumping long intersection chains of Omit/Pick straight on the user:
Prettify<T> = {
    [K in keyof T]: T[K]
} & {}

# loose autocomplete (you get autocomplete but you're still allowed to specify any string)
type SomeVals = 
  | "foo"
  | "bar"
  | (string & {});