For example:
function MyFunction() {
return 'here is my function'
}
function MyOtherFunction() {
return 'here is my other function'
}
export { MyOtherFunction }
declare global {
interface Window {
MyFunction: typeof MyFunction
}
}
window.MyFunction = MyFunction
MyFunction is not exported but is attached to the global window object, so the MyFunction types should be included in the d.ts file even if it is not exported.
The following are the results of the comparison using tsc and oxc-transform:
// by tsc
declare function MyFunction(): string;
declare function MyOtherFunction(): string;
export { MyOtherFunction };
declare global {
interface Window {
MyFunction: typeof MyFunction;
}
}
// by oxc-transform
declare function MyOtherFunction(): string;
export { MyOtherFunction };
declare global {
interface Window {
MyFunction: typeof MyFunction;
}
}
The file generated by oxc-transform is missing: declare function MyFunction(): string;