Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing types for compat in fluent-react #456

Open
soerenBoisen opened this issue Feb 21, 2020 · 1 comment
Open

Missing types for compat in fluent-react #456

soerenBoisen opened this issue Feb 21, 2020 · 1 comment
Labels

Comments

@soerenBoisen
Copy link

@soerenBoisen soerenBoisen commented Feb 21, 2020

Hi, as I understand it, the Typescript typings (@types/fluent__react) for this project is maintained here?
Otherwise please excuse this report.

When looking inside the typings for fluent-bundle, I see that there's a simple file to cover compat in the file compat.d.ts with this content:

export * from './index';

But such a file is not present in the typings for fluent-react. This means that anyone doing import {...} from '@fluent/react/compat' in their Typescript project will experience compile error if compiling with "noImplicitAny".

Can we please add a compat file for fluent-react also?

@stasm
Copy link
Contributor

@stasm stasm commented Apr 10, 2020

Hi @soerenBoisen, sorry for the belated reply.

@types/fluent__react is not maintained in this repo. It's a community-driven effort, which, by the way, is amazing :)

We've recently migrated @fluent/react as well as other @fluent packages to TypeScript. You can read more about the switch in #376; a number of people who had contributed to @types/fluent__react also helped with the transition.

@fluent/react 0.12 is the first version of @fluent/react written in TypeScript. The switch required a few changes to the public API. 0.12 is a breaking upgrade from 0.11. I'd love it if you could give it a try in your projects.

As far as I understand it, the typings generated and published in @fluent/react 0.12 only work when importing from "@fluent/react";. They don't work when importing from "@fluent/react/compat";. So I'm assuming your problem still persists. Sorry for the trouble.

I'd like to point you to an issue I filed just yesterday in which I proposed removing compat.js builds altogether; see #472. If your use-case wouldn't work well with the assumptions I outlined in that issue, would you mind commenting there?

Finally, I think that adding compat.d.ts files to our packages could help fix the problem, but it appears that we'd need to do it manually: either commit them in each package's root directory, or maybe create them from a script every time a build happens. While possible, this would add a bit to the complexity of our packaging system. If we could instead just remove compat.js builds, things would be much simpler :)

Let me know what you think, here or in #472. I'd like to help fix the problem you're having one way or another. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.