question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Why Fable.Import namespace has been removed ?

See original GitHub issue

By convention Fable bindings are under Fable.Import namespace.

Taking Monaco, as an example:

Problem, with the new version is the intellisense feel really strange.

    let options = jsOptions<Monaco.Monaco.Editor.IEditorConstructionOptions>(fun o ->
        let minimapOptions =  jsOptions<Monaco.Monaco.Editor.IEditorMinimapOptions>(fun oMinimap ->
            oMinimap.enabled <- Some false
        )
        o.language <- Some "html"
        o.fontSize <- Some 14.
        o.theme <- Some "vs-dark"
        o.value <- Some "<h1>Maxime</h1>"
        o.minimap <- Some minimapOptions
    )

Yes, I could open Monaco but even then I can still do Monaco.Monaco.

If we was having Fable.Import, we could have something like:

    open Fable.Import

    let options = jsOptions<Monaco.Editor.IEditorConstructionOptions>(fun o ->
        let minimapOptions =  jsOptions<Monaco.Editor.IEditorMinimapOptions>(fun oMinimap ->
            oMinimap.enabled <- Some false
        )
        o.language <- Some "html"
        o.fontSize <- Some 14.
        o.theme <- Some "vs-dark"
        o.value <- Some "<h1>Maxime</h1>"
        o.minimap <- Some minimapOptions
    )

And like that offer the same user experience as for Fable.Import.Browser, Fable.Import.JS, others bindings, etc.

In general, I use:

open Fable.Import

Browser.document.getElementById ....

Like that, I can easily scope and see which API I am using.

Issue Analytics

  • State:open
  • Created 6 years ago
  • Reactions:1
  • Comments:18 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
MangelMaximecommented, Mar 14, 2018

@ctaggart Ok I think I see, your point. Thanks for the explanations

And seems like your decision was the right one here 😃

1reaction
ctaggartcommented, Mar 14, 2018

Yes, I dropped the default namespace prefix of Fable.Import a long time ago and would prefer it not be added back. Configurable prefix would probably be good. Monaco.Monaco issue is a separate issue. Fable.Import.Monaco.Monaco would not be any better.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Announcing fable-compiler 2.2, Fable.Core 3 and more
Import.JS to Fable.Core.JS . Changing a namespace seems like a gratuitous breaking ... The nameof operator has been moved to the Fable.Core.
Read more >
cannot reference React in Fable
The compile errors I'm getting are: The namespace 'React' is not defined. ('open' statements); The type PureStatelessComponent is not defined.
Read more >
Fable: F# to JavaScript compiler
Import.* namespace is used for pure JS bindings with no business code, while libraries with an actual translation layer are placed in the...
Read more >
Opinionated Fable - Architecture & Performance - Kunjan's
So, it would always be good idea to have import folder for all this. A top level folder that we normally don't touch...
Read more >
Visual Studio 2019 version 16.0 Release Notes
Intellisense namespace) have been deprecated in favor of the LightBulb API and are no longer supported starting with Visual Studio 2019 Preview ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found