Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Named export Hook missing from types #92

Merged
merged 2 commits into from
Jun 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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')
Loading