kysely
kysely copied to clipboard
Allow plugins that transform results to affect the output type.
Hey 👋
Currently, if we use a plugin that transforms the query's results with .withPlugin(plugin), the type system is unaware of the transformations and the output type is left unchanged.
e.g. a plugin that enriches the results with some additional fields calculated in JS land.
An overload such as withPlugin<T>(plugin: ResultTransformingPlugin<O, T>): SelectQueryBuilder<T> would make for a nice addition to the arsenal.
Maybe, but it wouldn't work with plugins installed globally. Not unless we add a new generic to each builder.
Or with plugins installed before selections.
This would be a great addition - currently, the built-in CamelCasePlugin is somewhat unusable because of the discrepancy between the type system's outputs and the actual query results.