Skip to content
This repository has been archived by the owner on Dec 5, 2022. It is now read-only.

Type Issue #93

Open
giiyms opened this issue Oct 29, 2020 · 0 comments
Open

Type Issue #93

giiyms opened this issue Oct 29, 2020 · 0 comments

Comments

@giiyms
Copy link

giiyms commented Oct 29, 2020

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

1 participant