TS2322: Type '{ wait: false; }' is not assignable to type 'ReactOptions'.
This can happen when upgrading i18next from version "19.9.2" to "22.5.1".
The wait option that got removed was :
export interface ReactOptions { /** * Set to true if you like to wait for loaded in every translated hoc * @default false */ wait?: boolean;
And what is useSuspense used for ? Let's check the documentation
Wow very useful, thank you !
Actually Suspense is a React feature. It was first added for server-side lazy rendering but is also available on client-side frontends. It's used for lazy loading components. If you don't know what it is you are probably not using it. Then the default is fine since this parameter might not even affect your project.
As a side note in plugin options declaration that have default values, it's best not to declare option's parameters to the default value for two reasons:
- It's more readable if the default options are not included. Your config then lists only non-default values and you can grasp more easily how the config differs from other peoples project. In general default values are chosen carefully and should be changed only when having a good reason to.
- It's more maintainable. When the option is removed by the plugin/module maintainer and replaced or renamed, your config adapts automatically. This case is an example. If the coder had not written the useless `wait: false` which is anyway the default value, it would not have broke during upgrade.
Recent Comments