fable-compiler/ts2fable

Issue with generated code for p5js types

Opened this issue · 0 comments

I have @types/p5 (1.3.0) module in my project and ts2fable v0.7.1
I do

ts2fable node_modules/@types/p5/index.d.ts src/P5.fs -e p5

and I have

.../src/P5.fs(95,17): (95,24) error FSHARP: The namespace or module '__index' is not defined. (code 39)

in the generated P5.fs
Screenshot 2021-08-02 at 23 25 42


A piece of generated code ``` // ts2fable 0.7.1 module rec P5 open System open Fable.Core open Fable.Core.JS open Browser.Types

type RegExp = System.Text.RegularExpressions.Regex

module Constants =
module P5 = __index

module __index =

    type ANGLE_MODE =
        U2<RADIANS, DEGREES>

    type ARC_MODE =
        U3<CHORD, PIE, OPEN>

    type BEGIN_KIND =
        U7<POINTS, LINES, TRIANGLES, TRIANGLE_FAN, TRIANGLE_STRIP, QUADS, QUAD_STRIP>

    type BLEND_MODE =
        obj

    type COLOR_MODE =
        U3<RGB, HSB, HSL>

    type CURSOR_TYPE =
        U5<ARROW, CROSS, HAND, MOVE, TEXT>

    type DEBUG_MODE =
        U2<GRID, AXES>

    type ELLIPSE_MODE =
        U4<CENTER, RADIUS, CORNER, CORNERS>

    type END_MODE =
        CLOSE

    type FILTER_TYPE =
        U8<THRESHOLD, GRAY, OPAQUE, INVERT, POSTERIZE, BLUR, ERODE, DILATE>

    type GRAPHICS_RENDERER =
        U2<P2D, WEBGL>

    type HORIZ_ALIGN =
        U3<LEFT, CENTER, RIGHT>

    type IMAGE_MODE =
        U3<CORNER, CORNERS, CENTER>

    type RECT_MODE =
        U4<CORNER, CORNERS, CENTER, RADIUS>

    type RENDERER =
        U2<P2D, WEBGL>

    type SIZE_H =
        AUTO

    type SIZE_W =
        AUTO

    type STROKE_CAP =
        U3<SQUARE, PROJECT, ROUND>

    type STROKE_JOIN =
        U3<MITER, BEVEL, ROUND>

    type TEXTURE_MODE =
        U2<IMAGE, NORMAL>

    type THE_STYLE =
        U4<NORMAL, ITALIC, BOLD, BOLDITALIC>

    type TYPE =
        U2<VIDEO, AUDIO>

    type VERT_ALIGN =
        U4<TOP, BOTTOM, CENTER, BASELINE>

    type WRAP_X =
        U3<CLAMP, REPEAT, MIRROR>

    type WRAP_Y =
        U3<CLAMP, REPEAT, MIRROR>

    type DESCRIBE_DISPLAY =
        U2<LABEL, FALLBACK>

module Global =
module P5 = __index

type [<AllowNullLiteral>] IExports =
    /// <summary>Extracts the alpha value from a color or pixel
    /// array.</summary>
    /// <param name="color">p5.Color object, color components, or
    /// CSS color</param>
    abstract alpha: color: U3<P5.Color, ResizeArray<float>, string> -> float
    /// <summary>Extracts the blue value from a color or pixel
    /// array.</summary>
    /// <param name="color">p5.Color object, color components, or
    /// CSS color</param>
</details>