Comment Comment by hither_shores > Imagine I want to test a function that operates on quite large application state but not all app state is necessary for that functionIf 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() Conversely, if a function you don't control says it needs the whole app state, believe it. parent hither_shores 4 years ago
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.