Skip to content
This repository has been archived by the owner on Nov 18, 2024. It is now read-only.

Syntax errors when using fbt-collect on Typescript files #143

Closed
nashspence opened this issue May 20, 2020 · 4 comments
Closed

Syntax errors when using fbt-collect on Typescript files #143

nashspence opened this issue May 20, 2020 · 4 comments

Comments

@nashspence
Copy link
Contributor

🐛 Bug Report

When running fbt-collect on a Typescript file, it errors out with syntax errors due to Babel not recognizing Typescript-specific syntax. In order to have have Babel understand this syntax, you need to run Babel with the Typescript preset. However, presets are not currently a supported option on the cli. I will be submitting a pull request that adds this as an ability, which allows me to successfully use fbt-collect on a .tsx file.

To Reproduce

  • Run fbt-collect on a .tsx file that has Typescript-specific syntax

Expected behavior

  • fbt-collect collects the strings without erroring, just like it would on a .jsx file

Link to repo (highly encouraged) or paste

N/A

envinfo

System:
OS: macOS 10.15.4
CPU: (16) x64 Intel(R) Core(TM) i9-9900K CPU @ 3.60GHz
Memory: 1.30 GB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 13.13.0 - /usr/local/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.4 - /usr/local/bin/npm

@retyui
Copy link
Contributor

retyui commented May 23, 2020

Here is an article about Typescript + fbt where I describe problems that i faced and how to fix them

@nashspence
Copy link
Contributor Author

nashspence commented May 23, 2020

@retyui no worries man. I’ve also seen this article which has more info - https://medium.com/@frenchyooy/configuring-fbt-api-with-typescript-and-react-create-app-492ee72f44bb. We have fbt working nowadays in our typescript project. My only thing is that I’m hoping that the team will accept the PR I submitted for setting a Babel preset for the collect CLI to use. The import problem you mention may be a known issue #115 btw, tho it looks like it might be a little stale as it is tagged Needs Repro. I can confirm that we reproduced an import problem with our set up. Needed to put “fbt;” somewhere in the file to get it to work. This particular issue here tho is just about getting the fbt-collect CLI to be easily usable with typescript as I think is a goal of the project.

@jrwats
Copy link
Contributor

jrwats commented Jul 14, 2020

@nashspence we're actively working on landing your PR as I write this. Sorry for the delay, a few of us have been AFK due to COVID, etc!

@nashspence
Copy link
Contributor Author

@jrwats no worries no hurry. Thanks for the update and the tool. I’ve been away a bit myself too.

@jrwats jrwats closed this as completed Dec 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants