Skip to content

Commit

Permalink
Merge pull request #49 from jaredwray/types-definition-update
Browse files Browse the repository at this point in the history
types definition update
  • Loading branch information
jaredwray committed Jun 20, 2024
2 parents 20bb8da + 528370f commit 08e26d1
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 25 deletions.
27 changes: 3 additions & 24 deletions index.d.ts
Original file line number Diff line number Diff line change
@@ -1,26 +1,5 @@
// 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;
import HandlebarsLib from 'handlebars';
declare const handlebars: typeof HandlebarsLib;
declare let handlebarHelpers: any;
export default handlebars;

// Export the helpers function as a named export
export { handlebarHelpers };
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,7 @@
"mocha": "^10.4.0",
"rimraf": "^5.0.5",
"template-helpers": "^1.0.1",
"templates": "^1.2.9"
"templates": "^1.2.9",
"typescript": "^5.5.2"
}
}

0 comments on commit 08e26d1

Please sign in to comment.