dart-archive / js_facade_gen

Generates package:js Javascript interop facades for arbitrary TypeScript libraries
Apache License 2.0
161 stars 29 forks source link

Type Issue #93

Open giiyms opened 3 years ago

giiyms commented 3 years ago

Hello,

I am getting this error:

y-axis.d.ts:1:1: Could not format because the source could not be parsed:

line 29, column 11: Methods must have an explicit list of parameters.
   ╷
29 │  external BasicComponents.CartesianAxis.Type get type;
   │           ^^^^^^^^^^^^^^^
   ╵
line 29, column 40: An external or native method can't have a body.
   ╷
29 │  external BasicComponents.CartesianAxis.Type get type;
   │                                        ^
   ╵
line 29, column 40: A function body must be provided.
   ╷
29 │  external BasicComponents.CartesianAxis.Type get type;
   │                                        ^
   ╵
line 29, column 40: Expected a class member.
   ╷
29 │  external BasicComponents.CartesianAxis.Type get type;
   │                                        ^
   ╵
line 30, column 49: Expected an identifier.
   ╷
30 │  external set type(BasicComponents.CartesianAxis.Type v);
   │                                                 ^
   ╵
line 30, column 50: Expected to find ','.
   ╷
30 │  external set type(BasicComponents.CartesianAxis.Type v);
   │                                                  ^^^^
   ╵
line 37, column 91: Expected an identifier.
   ╷
37 │  external factory YAxis({ String/*'left'|'right'*/ position, BasicComponents.CartesianAxis.Type type, num offset}); }
   │                                                                                           ^
   ╵
line 37, column 92: Expected to find '}'.
   ╷
37 │  external factory YAxis({ String/*'left'|'right'*/ position, BasicComponents.CartesianAxis.Type type, num offset}); }
   │                                                                                            ^^^^
   ╵

It is coming from trying to convert this file:

declare namespace echarts {
    namespace EChartOption {
        /**
         * The y axis in cartesian(rectangular) coordinate.
         * Usually a single grid component can place at most 2 y axis,
         * one on the left and another on the right. offset can be used
         * to avoid overlap when you need to put more than two y axis.
         *
         * @see https://echarts.apache.org/en/option.html#yAxis
         */
        interface YAxis extends BasicComponents.CartesianAxis {
            /**
             * The first y axis in grid defaults to be the left (`'left'`)
             * of the grid, and the second y axis is on the other side
             * against the first y axis.
             */
            position?: 'left' | 'right';

            /**
             * Options:
             * + 'value' - Numerical axis, suitable for continuous data.
             * + 'category' Category axis, suitable for discrete category data.
             *   Data should only be set via 'data' for this type.
             * + 'time' Time axis, suitable for continuous time series data.
             *   As compared to value axis, it has a better formatting for time
             *   and a different tick calculation method.
             *   For example, it decides to use month, week, day or hour for tick
             *   based on the range of span.
             * + 'log' Log axis, suitable for log data.
             *
             * @default 'value'
             * @see https://echarts.apache.org/en/option.html#yAxis.type
             */
            type?: BasicComponents.CartesianAxis.Type;

            /**
             * Offset of this axis relative to default position.
             * Useful when multiple axis of this type has same position value.
             *
             * @default 0
             * @see https://echarts.apache.org/en/option.html#yAxis.offset
             */
            offset?: number;
        }
    }
}

The index.d.ts file has class:

namespace BasicComponents {
            ...
            namespace CartesianAxis {
                type Type = 'value' | 'category' | 'time' | 'log';

Any idea how to fix it?