Comments (13)
Here is an article about Typescript + fbt where I describe problems that i faced and how to fix them
UPD: use definition types:
yarn add @types/fbt
from fbt.
this could help https://github.com/sibelius/codemod-RN24-to-RN25/blob/master/transform.js#L22
from fbt.
collectFBT also throws when parsing typescript files with babel
Error: [BABEL] unknown: Configuration contains string/RegExp pattern, but no filename was passed to Babel
/entria-fullstack/node_modules/babel-plugin-fbt/bin/collectFBT.js:131
throw new Error(`Failed in ${errCount} files`);
^
Error: Failed in 1 files
at writeOutput (/entria-fullstack/node_modules/babel-plugin-fbt/bin/collectFBT.js:131:11)
at ReadStream.<anonymous> (/entria-fullstack/node_modules/babel-plugin-fbt/bin/collectFBT.js:169:5)
from fbt.
after #51
I've got this error:
Error: Line 37 Column 11: `fbt` is not bound. Did you forget to require('fbt')?
/entria-fullstack/node_modules/babel-plugin-fbt/bin/collectFBT.js:131
throw new Error(`Failed in ${errCount} files`);
^
Error: Failed in 1 files
at writeOutput (/entria-fullstack/node_modules/babel-plugin-fbt/bin/collectFBT.js:131:11)
at ReadStream.<anonymous> (/entria-fullstack/node_modules/babel-plugin-fbt/bin/collectFBT.js:169:5)
at ReadStream.emit (events.js:187:15)
at endReadableNT (_stream_readable.js:1094:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
it could be related to #46
from fbt.
- Support for Typescript files is certainly on our radar but not scheduled yet.
- Re: the error about the absence of
require('fbt')
. That check was useful before when we had no proper way to check thatfbt
was a defined variable in the JS module scope.Now that we've got better[EDIT] I've just rechecked and found thatFlow
support, we can remove this.Flow
is still not detecting<fbt>
as a normal JSX+React component, which is interpreted as a specialFbtElement
type. So for now, we'll need to keep that variable definition check.
from fbt.
@kayhadrin Do you have any pointers where that check is made? Or some way to work around it in the mean time? I wouldn't mind keeping a fork going until things are ready for typescript support.
from fbt.
@baluubas you can use my 2 pull requests
from fbt.
@baluubas I believe @sibelius answered your question.
from fbt.
Could you provide an example of how you're importing fbt
in your JS module?
I assume it's something like this:
import fbt from 'fbt';
// or
import {fbt} from 'fbt';
from fbt.
Iām using export default
Checking the code, I could use named or export default
For me, anyone of them could work
from fbt.
I've applied the your two PRs locally (#50 and #51),
converted the demo-app/src/example/Example.react.js
file to tsx
,
ran yarn manifest
and yarn collect-fbts
and it worked successfully.
If that's still an issue on your side, you may want to submit the minimum repro code in a Codepen.
from fbt.
It seems the pull requests were merged, can this issue be closed or is Typescript still not fully supported?
from fbt.
I'll close for now, and if any further issues around Typescript arise, we can investigate them as a separate issue.
from fbt.
Related Issues (20)
- Provide simple debug mode HOT 5
- No published version of babel-plugin-fbt since 0.13.0-beta HOT 2
- Remove fbjs dependency HOT 2
- Feature: publish eslint rules to help promote better Fbt API usage practices HOT 1
- Fix Support for Shared Enum Typescript/ES6 Import/export syntax with Babel 7 HOT 3
- Can't install FBT with npm HOT 1
- node-fetch vulnerability transitive from isomorphic-fetch HOT 3
- Unable to install react-native-fbt in expo SDK 45 bare workflow #33797 HOT 7
- Bug: unable to extract `intlList`
- Vite support HOT 1
- React 18 support
- unexpected pluralization behavior
- RTC-Folly outdated with lastest react native version (0.70.1) HOT 2
- Ols
- react-native-fbt not working on lastest React Native version (0.70.6) HOT 3
- Make `fbt` work with other compilers like SWC HOT 2
- New release? HOT 2
- fbt.plural manifest is wrong in --react-native-mode
- Copyright and footer logo needs to be updated
- Multiple bugs in substituteTokens HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
š Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ššš
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ā¤ļø Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fbt.