Skip to content

Commit

Permalink
fix: Named export Hook missing from types (#92)
Browse files Browse the repository at this point in the history
In #88 I added a named `Hook` export but forgot to update the TypeScript
types!
  • Loading branch information
timfish authored Jun 14, 2024
1 parent a8da141 commit c87090d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export type Options = {
internals?: boolean
}

declare class Hook {
export declare class Hook {
/**
* Creates a hook to be run on any already loaded modules and any that will
* be loaded in the future. It will be run once per loaded module. If
Expand Down
12 changes: 10 additions & 2 deletions test/typescript/ts-node.test.mts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import assert from 'node:assert/strict'
import { addHook } from '../../index.js'
import defaultHook, { Hook, addHook } from '../../index.js'
import { sayHi } from '../fixtures/say-hi.mjs'

addHook((url, exported) => {
Expand All @@ -8,4 +8,12 @@ addHook((url, exported) => {
}
})

assert.equal(sayHi('test'), 'Hooked')
new defaultHook((exported: any, name: string, baseDir: string|void) => {

});

new Hook((exported: any, name: string, baseDir: string|void) => {

});

assert.equal(sayHi('test'), 'Hooked')

0 comments on commit c87090d

Please sign in to comment.