-
-
Notifications
You must be signed in to change notification settings - Fork 933
Closed
Labels
C-bugCategory - BugCategory - Bug
Description
When a type and a function (example) share names and are exported together, the declarations are exported correctly, but .transform() does not export the function in its JS output.
Example
Input
type test = number;
function test(): test {
return 123;
}
export { test as Test };Output
// index.d.ts
type test = number;
declare function test(): test;
export { test as Test };
// index.mjs
function test() {
return 123;
}
export {};
// Expected: export { test as Test };Script
import oxc from 'npm:oxc-transform'; // 0.22.0
// ...
let entry = resolve('foo.ts');
let source = await Deno.readTextFile(entry);
let esm = oxc.transform(entry, source);
if (esm.errors.length > 0) bail('transform', esm.errors);
let outfile = join(outdir, 'index.mjs');
console.log('> writing "index.mjs" file');
await Deno.writeTextFile(outfile, esm.sourceText);
let dts = oxc.isolatedDeclaration(entry, source);
if (dts.errors.length > 0) bail('dts', dts.errors);
outfile = join(outdir, 'index.d.ts');
console.log('> writing "index.d.ts" file');
await Deno.writeTextFile(outfile, dts.sourceText);Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
C-bugCategory - BugCategory - Bug
Type
Fields
Give feedbackPriority
None yet