Consider exporting `Fbt`, `FbtParam`, `FbtPlural`
See original GitHub issue🚀 Feature Proposal
Export “empty” Fbt
components
Motivation
Allow fbt
to work better with TypeScript and friends. With this change types could be added to DefinentlyTyped and would make the setup a lot easier for TypeScript projects.
I think that it would make learning fbt
easier in some sense too, using <fbt>
and <fbt:param>
throws people off when first seeing it.
Also if the babel-plugin was updated to I think we could remove the need for a auto-import option described in #194
Example
Please provide an example for how this feature would be used.
import {Fbt} from 'fbt'
function App() {
return <Fbt desc="Greeting">Hello world</Fbt>
}
Pitch
I don’t see how this could be solved outside of fbt
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:6 (6 by maintainers)
Top Results From Across the Web
Auto import fbt in babel plugin · Issue #194 - GitHub
Feature Proposal Add support to auto import fbt in the babel plugin. ... Consider exporting Fbt , FbtParam , FbtPlural #202.
Read more >Parameters and interpolation | FBT - Meta Open Source
Interpolation of dynamic text and other markup is accomplished in the FBT framework via ` or fbt.param`:
Read more >How to add support Typescript for FBT an internationalization ...
import * as React from "react"; import fbt from "fbt"; const App = () => ( <fbt desc="welcome message"> Hi fbt & Typescript<fbt:param...
Read more >TypeScript 4.2 Iteration Plan · Issue #41601 · microsoft/TypeScript ...
Consider exporting Fbt , FbtParam , FbtPlural facebook/fbt#202. Open. Sign up for free to join this conversation on GitHub. Already have an account?...
Read more >Viewing online file analysis results for 'Facebook Hacker.exe'
... constructs such as fbt.plural() and the third positional `variations` argument to fbt.param() are currently disallowed":"";typeof e==="string"||Array.
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 FreeTop 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
Top GitHub Comments
I’d like to support this proposal as well. Using
JSXNamespacedName
likefbt:param
seems to be quite unconventional (even though valid) and it causes issues in various places like this one for example: https://github.com/yannickcr/eslint-plugin-react/pull/2961Having something which is more “reacty” would be very nice.
Actually I was able to get typings to work with namespaced elements (
<fbt:param>
etc), so just creating@types/fbt
would solve a lot. Might pick that up once I have some extra time.Atm I just copied https://gist.github.com/retyui/c3bd35220fb5c95c322df866834f0913#file-index-d-ts locally. And you can even make it work in plain JS projects in VSCode with a
jsconfig.json
file.