1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
|
=== /index.ts ===
// only an esm file can `import` both kinds of files
import obj1 from "./sub1/uses.js"
>obj1 : ImportInterface
import obj2 from "./sub2/uses.js"
>obj2 : typeof obj2
export default [obj1, obj2.default] as const;
>[obj1, obj2.default] as const : readonly [ImportInterface, RequireInterface]
>[obj1, obj2.default] : readonly [ImportInterface, RequireInterface]
>obj1 : ImportInterface
>obj2.default : RequireInterface
>obj2 : typeof obj2
>default : RequireInterface
=== /node_modules/pkg/import.d.ts ===
export {};
declare global {
>global : typeof global
interface ImportInterface { _i: any; }
>_i : any
function getInterI(): ImportInterface;
>getInterI : () => ImportInterface
}
=== /node_modules/pkg/require.d.ts ===
export {};
declare global {
>global : typeof global
interface RequireInterface { _r: any; }
>_r : any
function getInterR(): RequireInterface;
>getInterR : () => RequireInterface
}
=== /sub1/uses.ts ===
/// <reference types="pkg" />
export default getInterI();
>getInterI() : ImportInterface
>getInterI : () => ImportInterface
=== /sub2/uses.ts ===
/// <reference types="pkg" />
export default getInterR();
>getInterR() : RequireInterface
>getInterR : () => RequireInterface
|