Skip to content

Commit

Permalink
Update index.d.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
jaredwray committed Jun 17, 2024
1 parent 4cece3b commit 151d9b0
Showing 1 changed file with 26 additions and 3 deletions.
29 changes: 26 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,26 @@
// index.d.ts
import * as Handlebars from 'handlebars';
export = Handlebars;
// Import necessary types from the Handlebars library
import { HelperDelegate, HandlebarsLib as HandlebarsNamespace } from 'handlebars';

// Define a type for the Handlebars instance
export interface HandlebarsInstance extends HandlebarsNamespace {
create: () => HandlebarsInstance;
registerHelper: (name: string, fn: HelperDelegate) => void;
}

// Define the type for the parameters of the helpers function
interface HelpersParams {
handlebars: HandlebarsInstance;
}

// Define the type for the helpers function
declare function helpers(params: HelpersParams): void;

// Declare the variable to hold the helpers function, which may be undefined initially
declare let handlebarHelpers: typeof helpers | undefined;

// Declare the Handlebars instance as a HandlebarsInstance and export it as the default export
declare const handlebars: HandlebarsInstance;
export default handlebars;

// Export the helpers function as a named export
export { handlebarHelpers };

0 comments on commit 151d9b0

Please sign in to comment.