File tree 2 files changed +22
-12
lines changed
2 files changed +22
-12
lines changed Original file line number Diff line number Diff line change 1
- export { register } from './register.js' ;
1
+ export {
2
+ register ,
3
+ type InitializationOptions ,
4
+ type NamespacedUnregister ,
5
+ type Register ,
6
+ type RegisterOptions ,
7
+ type Unregister ,
8
+ } from './register.js' ;
9
+ export type { ScopedImport } from './scoped-import.js' ;
2
10
export { tsImport } from './ts-import.js' ;
Original file line number Diff line number Diff line change @@ -8,21 +8,23 @@ export type InitializationOptions = {
8
8
port ?: MessagePort ;
9
9
} ;
10
10
11
- type Options = {
11
+ export type RegisterOptions = {
12
12
namespace ?: string ;
13
13
onImport ?: ( url : string ) => void ;
14
14
} ;
15
15
16
- type Unregister = ( ) => Promise < void > ;
17
- type Register = {
18
- ( options : {
19
- namespace : string ;
20
- onImport ?: ( url : string ) => void ;
21
- } ) : Unregister & {
22
- import : ScopedImport ;
23
- unregister : Unregister ;
24
- } ;
25
- ( options ?: Options ) : Unregister ;
16
+ export type Unregister = ( ) => Promise < void > ;
17
+
18
+ export type NamespacedUnregister = Unregister & {
19
+ import : ScopedImport ;
20
+ unregister : Unregister ;
21
+ } ;
22
+
23
+ type RequiredProperty < Type , Keys extends keyof Type > = Type & { [ P in Keys ] -?: Type [ P ] } ;
24
+
25
+ export type Register = {
26
+ ( options : RequiredProperty < RegisterOptions , 'namespace' > ) : NamespacedUnregister ;
27
+ ( options ?: RegisterOptions ) : Unregister ;
26
28
} ;
27
29
28
30
export const register : Register = (
You can’t perform that action at this time.
0 commit comments