Why Fable.Import namespace has been removed ?
See original GitHub issueBy convention Fable bindings are under Fable.Import
namespace.
Taking Monaco, as an example:
- Previous version of ts2fable: https://github.com/fable-compiler/repl/blob/master/src/Monaco/Monaco.fs#L1-L12
- Binding generated with current master branch of the repo: https://github.com/fable-compiler/ts2fable-exports/blob/dev/Monaco.fs#L1-L10
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:
- Created 6 years ago
- Reactions:1
- Comments:18 (18 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@ctaggart Ok I think I see, your point. Thanks for the explanations
And seems like your decision was the right one here 😃
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.