Skip to content

Commit c87090d

Browse files
authored
fix: Named export Hook missing from types (#92)
In #88 I added a named `Hook` export but forgot to update the TypeScript types!
1 parent a8da141 commit c87090d

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

index.d.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export type Options = {
2727
internals?: boolean
2828
}
2929

30-
declare class Hook {
30+
export declare class Hook {
3131
/**
3232
* Creates a hook to be run on any already loaded modules and any that will
3333
* be loaded in the future. It will be run once per loaded module. If

test/typescript/ts-node.test.mts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import assert from 'node:assert/strict'
2-
import { addHook } from '../../index.js'
2+
import defaultHook, { Hook, addHook } from '../../index.js'
33
import { sayHi } from '../fixtures/say-hi.mjs'
44

55
addHook((url, exported) => {
@@ -8,4 +8,12 @@ addHook((url, exported) => {
88
}
99
})
1010

11-
assert.equal(sayHi('test'), 'Hooked')
11+
new defaultHook((exported: any, name: string, baseDir: string|void) => {
12+
13+
});
14+
15+
new Hook((exported: any, name: string, baseDir: string|void) => {
16+
17+
});
18+
19+
assert.equal(sayHi('test'), 'Hooked')

0 commit comments

Comments
 (0)