-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #47 from jaredwray/esm-support-for-handlebarhelpers
esm support for handlebarhelpers
- Loading branch information
Showing
2 changed files
with
34 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters