kanel-kysely
Version:
Kysely extension for Kanel
18 lines (17 loc) • 1.01 kB
TypeScript
import type { CompositeDetails, Declaration, InstantiatedConfig, InterfacePropertyDeclaration, TypeImport } from "kanel";
import type MakeKyselyConfig from "./MakeKyselyConfig";
/**
* This is a quirky way to get Kysely interfaces. Basically, what happens is that this
* hook will filter out initializer and mutators. It takes the selector and transforms
* it into the Kysely *Table interface, by going over each property. In the end,
* it adds the New* and *Update types as per the Kysely documentation.
*
* This only works when the output from Kanel is close to the default configuration,
* if you've changed things around too much it will probably not work.
*/
declare const processFile: (declarations: Declaration[], compositeDetails: CompositeDetails, instantiatedConfig: InstantiatedConfig, path: string, makeKyselyConfig: MakeKyselyConfig) => {
modifiedDeclarations: Declaration[];
tableImport: TypeImport;
tableProperty: InterfacePropertyDeclaration;
};
export default processFile;