Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on The type system is a programmer's best friend. Parent comment
If not all app state is necessary for that function, it shouldn't require the whole app state in its arguments.
type AppState = { databaseConnection: DatabaseConnection, env : "dev" | "prod", apiToken: string, userId: string, ... } & SomeOtherStuff const dropTables = (app: Pick<AppState, "databaseConnection"> & {env: "dev"} ) => app.databaseConnection.dropTables()
There are no comments on this comment yet.
If not all app state is necessary for that function, it shouldn't require the whole app state in its arguments.
Conversely, if a function you don't control says it needs the whole app state, believe it.