genes icon indicating copy to clipboard operation
genes copied to clipboard

Interfaces are exported in a strange way?

Open vantreeseba opened this issue 1 year ago • 1 comments

IModule2D.hx

package dropecho.noise;

import dropecho.utils.FastMath;

interface IModule2D {
	public function value(x:F32, y:F32):F32;
}

IModule2d.d.ts

import {F32} from "../utils/FastMath"

export declare interface IModule2D {
	value(x: F32, y: F32): F32
}

IModule2d.js

import {Register} from "../../genes/Register.js"

const $global = Register.$global

export const IModule2D = function() {};
IModule2D.__isInterface__ = true;

index.js

export {IModule2D} from "./dropecho/noise/IModule2D.js"

This causes the export to think it's exporting a type (though this is fine in JS since it ignores those anyway).

vantreeseba avatar Jun 21 '24 20:06 vantreeseba

Outside of Haxe the exported value is mostly useless and the properties it has might change with Haxe versions.

I guess I could adjust it to:

export namespace IModule2D {
  export const __isInterface__ = true
}
export interface IModule2D {
  value(x: F32, y: F32): F32
}

Would that be closer to what you'd expect?

benmerckx avatar Jun 24 '24 08:06 benmerckx