mirror of
https://github.com/knex/knex.git
synced 2025-11-29 00:16:20 +00:00
* Use number instead of number | string for return type of count Closes #3247 * Use an alias instead of interface for DeferredKeySelection This prevents typescript from complaining when it has to be used in an exported signature without us having to expose internal type as public Closes #3259 * Make count result type overridable * Disable interface-over-type-literal rule
28 lines
877 B
TypeScript
28 lines
877 B
TypeScript
// This empty interface serves as a placeholder which userland code can augment to
|
|
// override result types.
|
|
//
|
|
// Currently only available result type which is overridable is Count, which defaults to
|
|
// number | string;
|
|
//
|
|
// Following example in userland code will alter this to be just number:
|
|
//
|
|
// declare module "knex/types/result" {
|
|
// interface Registry {
|
|
// Count: number;
|
|
// }
|
|
// }
|
|
//
|
|
// Prior discussion: https://github.com/tgriesser/knex/issues/3247
|
|
export interface Registry {
|
|
// We can't actually have default types here
|
|
// because typescript's augmentation will not permit
|
|
// overriding the type of a property already present.
|
|
//
|
|
// But the effective defaults are documented below:
|
|
//
|
|
// Count: number | string;
|
|
//
|
|
// Refer to Knex.Lookup type operator to see how the defaults
|
|
// are actually specified.
|
|
}
|