fluent.js
fluent.js copied to clipboard
Missing types for compat in fluent-react
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?
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!