You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
slice2js wrongly assumes that a forward defined type is defined in the file where the forward declaration is found.
slice2js needs to be aware where the actual definition for a type is when generating the TypeScript definitions, that is required in order to generate the corresponding import statements.
To solve this we will introduce a new metadata directive js:defined-in:<Path> where <Path> is the relative path to the Slice file containing the definition for the given type, the metadata applies to forward definitions.
// forward.ice
module Demo
{
["js:defined-in:point.ice"]
class Point;
}
// point.ice
module Demo
{
class Point
{
int x;
int y;
};
}
// line.ice
#include <forward.ice>
module Demo
{
class Line
{
Point x;
Point y;
}
}
The generated code will correctly import the defined-in file, instead of the file containing the forward declaration:
import * as iceNS0 from "ice"
import * as iceNS1 from "./point"
export namespace Demo
{
class Line extends iceNS0.Ice.Value
{
/**
* One-shot constructor to initialize all data members.
*/
constructor(x?:iceNS1.Demo.Point, y?:iceNS1.Demo.Point);
x:iceNS1.Demo.Point;
y:iceNS1.Demo.Point;
}
}
The text was updated successfully, but these errors were encountered:
slice2js wrongly assumes that a forward defined type is defined in the file where the forward declaration is found.
slice2js needs to be aware where the actual definition for a type is when generating the TypeScript definitions, that is required in order to generate the corresponding import statements.
To solve this we will introduce a new metadata directive
js:defined-in:<Path>
where<Path>
is the relative path to the Slice file containing the definition for the given type, the metadata applies to forward definitions.The generated code will correctly import the defined-in file, instead of the file containing the forward declaration:
The text was updated successfully, but these errors were encountered: